I have encountered a similar problem: 
If a table column starts with an empty cell, Table.getColumn returns an empty 
array.
If a table column has an empty cell further down, Table.getColumn returns a 
truncated array until that cell.
So I wonder if this is a related bug. 

Macro to reproduce:

tableName = "Test Table";
Table.create(tableName);
Table.set("ABC", 0, "", tableName);
Table.set("ABC", 1, "A", tableName);
Table.set("ABC", 2, "B", tableName);
Table.set("ABC", 3, "C", tableName);
Table.set("ABC", 4, "", tableName);
Table.set("ABC", 5, "D", tableName);

ABC = Table.getColumn("ABC", tableName);
Array.show(ABC);
waitForUser("ABC column is now empty, with length: " + ABC.length);

Table.set("ABC", 0, "blank", tableName);
ABC = Table.getColumn("ABC", tableName);
Array.show(ABC);
waitForUser("ABC column is now populated, but with too short length: " + 
ABC.length);

Table.set("ABC", 4, "blank", tableName);
ABC = Table.getColumn("ABC", tableName);
Array.show(ABC);
waitForUser("ABC column is now correct, with length: " + ABC.length);


Stein

-----Original Message-----
From: Wayne Rasband <[email protected]> 
Sent: tirsdag 2. april 2024 20:00
Subject: Re: Table shows NaNs instead empty fields

> On Apr 2, 2024, at 9:13 AM, Norbert Vischer <[email protected]> wrote:
> 
> Hello all (Wayne?)
> 
> I want to use table columns for string flags, but I get the following problem:
> When I save and reload the table, empty fields after the last flag are filled 
> with"NaN".
> Explicitly setting fields to empty strings before saving does not help.

Hi Norbert,

This bug is fixed in the ImageJ 1.54j13 daily build.

-wayne

> tabName = "Test.csv";
> Table.create(tabName);
> ColA = newArray(10);
> Table.setColumn("Nums", ColA, tabName); Table.setColumn("Flags", 
> newArray(0), tabName); Table.set("Flags", 4, "ABC", tabName); 
> Table.update(tabName); dir = getDir("temp"); Table.save(dir + tabName, 
> tabName); waitForUser; open(dir + tabName);
> 
> /* output:
> 0
> 0
> 0
> 0
> 0    ABC
> 0    NaN
> 0    NaN
> 0    NaN
> 0    NaN
> 0    NaN
> */
> 

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to