?Bug in updating tables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

?Bug in updating tables

Toby Cornish
First, I love the tables.  They are very nice.

I am having problems with updating tables beyond the first 25 rows.

The below macro creates a table, fills 50 rows with (0..49),1,2,3

It then tries to update those rows with (50..100),A,B,C

It updates the first 25 rows, leaves rows 26 to 50 untouched, and then puts garbled contents in rows 75 to 100

Maybe I messed something up.

Thanks,

toby Cornish



if (isOpen("bob"))
  print("[bob]", "\\Clear");
else
  run("New... ", "name=[bob] type=Table width=250 height=600");

print("[bob]", "\\Headings:col1\tcol2\tcol3\tcol4");

rowIndex=0;
for(i=0;i<50;i++) {
  rowString = ""+rowIndex+"\t1\t2\t3";
  print("[bob]", rowString);
  rowIndex++;
}

for(i=0;i<50;i++) {
  rowString = ""+rowIndex+"\tA\tB\tC";
  print("[bob]", "\\Update"+i+":"+rowString);
  rowIndex++;
}
Reply | Threaded
Open this post in threaded view
|

Re: ?Bug in updating tables

Gabriel Landini
On Friday 20 July 2007 04:25:56 Toby Cornish wrote:
> First, I love the tables.  They are very nice.
> I am having problems with updating tables beyond the first 25 rows.
> The below macro creates a table, fills 50 rows with (0..49),1,2,3
> It then tries to update those rows with (50..100),A,B,C

You haven't got 100 rows, you've got 50.

This modification works fine, but not sure it is what you are looking for:

if (isOpen("bob"))
  print("[bob]", "\\Clear");
else
  run("New... ", "name=[bob] type=Table width=250 height=600");

print("[bob]", "\\Headings:col1\tcol2\tcol3\tcol4");

for(i=0;i<10;i++) {
  rowString = ""+i+"\t1\t2\t3";
  print("[bob]", rowString);
}

rowString = "\tA\tB\tC";
wait(1000);
beep();

for(i=5;i<10;i++) {
  print("[bob]", "\\Update"+i+":"+i+rowString);
}
Reply | Threaded
Open this post in threaded view
|

Re: ?Bug in updating tables

Toby Cornish
I am not sure that I communicated my problem appropriately.

My example creates a table with 50 rows without problem.  Then it tries to update the middle 40 rows with new data.  After row 25, the update fails and a bunch of extra  garbled rows are added at the end of the table.

if you don't go beyond 25 rows, there is no problem.  Your counter-example works flawlessly b/c it only contains 10 rows.

here is your counter-example modified to print 50 rows then update rows 5 through 45:


if (isOpen("bob"))
  print("[bob]", "\\Clear");
else
  run("New... ", "name=[bob] type=Table width=250 height=600");

print("[bob]", "\\Headings:col1\tcol2\tcol3\tcol4");

for(i=0;i<50;i++) {
  rowString = ""+i+"\t1\t2\t3";
  print("[bob]", rowString);
}

rowString = "\tA\tB\tC";
wait(1000);
beep();

for(i=5;i<45;i++) {
  print("[bob]", "\\Update"+i+":"+i+rowString);
}


toby



>>> Gabriel Landini <[hidden email]> 7/20/2007 6:35 AM >>>
On Friday 20 July 2007 04:25:56 Toby Cornish wrote:
> First, I love the tables.  They are very nice.
> I am having problems with updating tables beyond the first 25 rows.
> The below macro creates a table, fills 50 rows with (0..49),1,2,3
> It then tries to update those rows with (50..100),A,B,C

You haven't got 100 rows, you've got 50.

This modification works fine, but not sure it is what you are looking for:

if (isOpen("bob"))
  print("[bob]", "\\Clear");
else
  run("New... ", "name=[bob] type=Table width=250 height=600");

print("[bob]", "\\Headings:col1\tcol2\tcol3\tcol4");

for(i=0;i<10;i++) {
  rowString = ""+i+"\t1\t2\t3";
  print("[bob]", rowString);
}

rowString = "\tA\tB\tC";
wait(1000);
beep();

for(i=5;i<10;i++) {
  print("[bob]", "\\Update"+i+":"+i+rowString);
}
Reply | Threaded
Open this post in threaded view
|

Re: ?Bug in updating tables

Gabriel Landini
On Friday 20 July 2007 15:49:26 Toby Cornish wrote:
> I am not sure that I communicated my problem appropriately.

> My example creates a table with 50 rows without problem.  Then it tries to
> update the middle 40 rows with new data.  After row 25, the update fails
> and a bunch of extra  garbled rows are added at the end of the table.
>
> if you don't go beyond 25 rows, there is no problem.  Your counter-example
> works flawlessly b/c it only contains 10 rows.
>
> here is your counter-example modified to print 50 rows then update rows 5
> through 45:

I see, yes there seems to be a problem with the \\Update command beyond 25
rows.

Cheers,
G.
Reply | Threaded
Open this post in threaded view
|

Re: ?Bug in updating tables

Wayne Rasband
In reply to this post by Toby Cornish
This bug is fixed in ImageJ 1.39a, now available at
<http://rsbweb.nih.gov/ij/notes.html>.

Here are two more macros that demonstrate how to create and update
tables:

    http://rsbweb.nih.gov/ij/macros/SineCosineTable2.txt
    http://rsbweb.nih.gov/ij/macros/TableTricks.txt

-wayne



> First, I love the tables.  They are very nice.
>
> I am having problems with updating tables beyond the first 25 rows.
>
> The below macro creates a table, fills 50 rows with (0..49),1,2,3
>
> It then tries to update those rows with (50..100),A,B,C
>
> It updates the first 25 rows, leaves rows 26 to 50 untouched, and then
> puts garbled contents in rows 75 to 100
>
> Maybe I messed something up.
>
> Thanks,
>
> toby Cornish
>
>
>
> if (isOpen("bob"))
>   print("[bob]", "\\Clear");
> else
>   run("New... ", "name=[bob] type=Table width=250 height=600");
>
> print("[bob]", "\\Headings:col1\tcol2\tcol3\tcol4");
>
> rowIndex=0;
> for(i=0;i<50;i++) {
>   rowString = ""+rowIndex+"\t1\t2\t3";
>   print("[bob]", rowString);
>   rowIndex++;
> }
>
> for(i=0;i<50;i++) {
>   rowString = ""+rowIndex+"\tA\tB\tC";
>   print("[bob]", "\\Update"+i+":"+rowString);
>   rowIndex++;
> }
>