- rename example modules from "example" to "swigexample", to avoid a warning from shadowing the Octave built-in function "example" - remove deprecated "static" Makefile targets: there is no longer an option to build static Octave modules in the Examples Makefile - emacs whitespace cleanup run on all files
35 lines
435 B
Matlab
35 lines
435 B
Matlab
# file: runme.m
|
|
|
|
swigexample
|
|
|
|
# Call some templated functions
|
|
swigexample.maxint(3,7)
|
|
swigexample.maxdouble(3.14,2.18)
|
|
|
|
# Create some class
|
|
|
|
iv = swigexample.vecint(100)
|
|
dv = swigexample.vecdouble(1000)
|
|
|
|
for i=0:99,
|
|
iv.setitem(i,2*i);
|
|
end
|
|
|
|
for i=0:999,
|
|
dv.setitem(i, 1.0/(i+1));
|
|
end;
|
|
|
|
sum = 0;
|
|
for i=0:99
|
|
sum = sum + iv.getitem(i);
|
|
end
|
|
sum
|
|
|
|
sum = 0.0;
|
|
for i=0:999,
|
|
sum = sum + dv.getitem(i);
|
|
end
|
|
sum
|
|
|
|
clear iv
|
|
clear dv
|