0

Imagej's table will not save the previous entry, rather overwrites the current row with the new info provided from the array's. Is their anyway to allow it to make a new row for every new set of data acquired?

//// Create T
Table.create('Chromataphore Data');
Table.set('PunchID',0,1);
Table.set('Count', 0, b);
Table.set('Total Area', 0, a);

ive tried "setResults()"

zZz ZzZ
  • 1
  • 1
  • Again a cross-post from the Image.sc Forum ... You need to properly set the table row number! – Herbie Aug 14 '23 at 20:29
  • As @Herbie says `Table.set(columnName, rowIndex, value);` Assigns a numeric or string value to the cell at the specified column and row. The best way to approach this is to use a loop. Increment the rowIndex with each iteration otherwise (as you've found) you will overwrite the 1st row (rowIndex = 0) when you run this again. – quantixed Aug 14 '23 at 20:52

1 Answers1

0

The easiest way is to use the default Results table with

setResult("Column", row, value);

In your case the code would look like:

setResult( "PunchID", nResults, 1 );
setResult( "Count", nResults-1, b );
setResult( "Total Area", nResults-1, a );

This ensures that every time you call the above, the data is written to a new table row.

Herbie
  • 143
  • 5