Searching/lookup value in Results table
Posted by AJBell on Jun 27, 2011; 8:57am
URL: http://imagej.273.s1.nabble.com/Searching-lookup-value-in-Results-table-tp3684125.html
Dear list,
I have hit a problem writing a macro. In esscence, measurements are taken of ROI from multiple images and stored in a single Results table. Some of these values then need to be altered as part of a user feedback loop. When storing the measurements, the ROI name, as retrieved by the getInfo("roi.name") command is used as an identifier.
The table I end up with looks like the following, albeit with several thousand rows:
Label Area IntDen
1 0172-0039 4.78000E2 1.45210E4
2 0173-0058 6.64000E2 1.93700E4
3 0174-0056 2.06000E2 2.64430E4
If I try to select a row based on the Label value using the following:
x = "0172-0039";
y= 600;
for(i=0; i<nResults; i++) {
rowId = getResult("Label", i);
if(rowId==x) {
setResult("Area", i, y);
}
}
I get no return result. I added a print function before the If to see what value of rowId was being obtained, and was given NaN. Is there a way around the non-numeric error or is there an easier way to do what I would like to? Any help or suggestions would be welcome.
Andrew
Andrew Bell
Department of Infection, Immunity and Inflammation
Maurice Shock Medical Sciences Building
University of Leicester
University Road
Leicester
LE1 9HN
United Kingdom