Get each value out of an array

Hi,

How can I extract the values out of an array?

Something like this:

xyz_values = Table.showArrays(“Lab_values”, L, a, b);
for (i = 0; i<xyz_values.length; i++) {
a1 = getResult(“x”, i);
b1 = getResult(“y”, i);
c1 = getResult(“z”, i);
}

Li

so I used this one, but whenever I print L1, a1 or b1 y get “NaN”. I’m working with a Non result table.

selectWindow(“Lab_values”);
for (i = 0; i<nResults; i++) {
L1 = getResult(L[i], i);
a1 = getResult(a[i], i);
b1 = getResult(b[i], i);
}

In ImageJ Macro language, you’ll have to temporarily rename your table to “Results” (using IJ.renameResults(oldName,newName)), then you can use the getResult() function as expected.

Or, alternatively, use the Table.get(...) method to work with the front-most table.


In any other of the supported (full-fledged) scripting languages, you can use the ResultsTable API to directly ask for the value in your table.