0

I'm writing a macro that creates a results table that looks like this:

Name value1 value2
string1 number number
string2 number number

At this point, if I use the getResultString("Name", 0) command in a loop I get the desired result (string1).
However, I need to save the table and re-open it at a later point.

If I save the Results table, close it and import it as a Results table, getResultString("Name", 0) gives me "Null" as an answer. I tried saving it as .txt, .csv, or .xls files but the problem persists.

The re-imported table looks the same, but for some reason getResultString doesn't seem to work.

Any pointers? Workarounds?

1 Answers1

1

The behaviour you observed is a bug. I was able to reproduce it using the following macro:

row = nResults;
dir = getDirectory("temp");

setResult("String", row, "xyz");
setResult("Number", row, 5.0);

// get results from new table
print(getResultString("String", 0));
print(getResult("Number", 0));

saveAs("Results", dir + "Results.xls");
open(dir + "Results.xls");

// get results from re-opened table
print(getResultString("String", 0));
print(getResult("Number", 0));

I filed a bug report, please also read how to best report bugs in ImageJ.

UPDATE: the bug was fixed by Wayne Rasband in ImageJ 1.50c8 with the comment:

Note that the bug only occurs when the first column is non-numeric and all other columns are numeric.

Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51