log with two columns

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

log with two columns

Frank Sprenger
Hello,


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?


Thanks for any help


Best
Frank
Reply | Threaded
Open this post in threaded view
|

Re: log with two columns

Rasband, Wayne (NIH/NIMH) [E]
> 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