Login  Register

Re: log with two columns

Posted by Rasband, Wayne (NIH/NIMH) [E] on Mar 27, 2010; 3:22pm
URL: http://imagej.273.s1.nabble.com/log-with-two-columns-tp3688766p3688767.html

> Is it possible to create and print to a log window with two colums in which
> certain data pairs (in my case selected and manipulated values coming
> from the Results window) are printed?

You can display multiple columns in a separate window. This example displays sine and cosine values in a "Sine/Cosine Table" window.

  title1 = "Sine/Cosine Table";
  title2 = "["+title1+"]";
  f = title2;
  if (isOpen(title1))
     print(f, "\\Clear");
  else
     run("Table...", "name="+title2+" width=250 height=600");
  print(f, "\\Headings:n\tSine\tCosine");
  for (n=0; n<=2*PI; n += 0.1)
     print(f, n + "\t" + sin(n) + "\t" + cos(n));

It's easier to display tabular data in the "Results" window.

  run("Clear Results");
  for (i=0, n=0; n<=2*PI; i++, n+=0.1) {
     setResult("n", i, n);
     setResult("sin(n)", i, sin(n));
     setResult("cos(n)", i, cos(n));
  }
  updateResults;

-wayne