In a macro, how can I index upon an array whose name and length are passed to a function?
Posted by Bill Christens-Barry on Jan 29, 2009; 8:07pm
URL: http://imagej.273.s1.nabble.com/In-a-macro-how-can-I-index-upon-an-array-whose-name-and-length-are-passed-to-a-function-tp3693895.html
In a macro, how can I index upon an array whose name and length are passed to a function? This
nonworking example shows what I'd like to do:
a = newArray(1, 2, 3);
b = newArray(4, 5, 6, 7);
sumTheArray("a", 3);
sumTheArray("b", 4);
function sumTheArray(arrayName, n) {
theArraySum = 0;
for (i = 0, i < n; i++) {
theArraySum += arrayName[n];
print(theArraySum);
}
}
Bill Christens-Barry