Login  Register

Re: Confused writing a macro

Posted by Michael Schmid on Nov 10, 2009; 5:47pm
URL: http://imagej.273.s1.nabble.com/Confused-writing-a-macro-tp3690490p3690491.html

Hi Greg,

the error message is exact; you cannot use saveAs for saving the list  
of points of a Plot window. The PlotGetValuesDemo macro shows you how  
to get the values from a plot and print them into the 'Log' window:

   Plot.getValues(x, y);
   for (i=0; i<x.length; i++)
     print(x[i], y[i]);

Then, you can save the contents of the 'Log' window and close it.

Michael
________________________________________________________________

On 10 Nov 2009, at 18:23, GDC wrote:

> Hello
>
> I couldn't find my answer by using the search function on Nabble so  
> i am
> asking here.  I am trying to write a macro that will do multiple plot
> profiles in an image.  For example i need to get a profile from x=1  
> to x=319
> at y=90, 95, 100, and 105 and save the plot in some ascii format.  
> When I
> run the macro I have written, i get an error sayin that I need a  
> log window
> in order to save txt files.  I'm not sure what this means or how to  
> fix it.
> Below is the macro I've written
>
> //setTool(4);
> makeLine(1, 90, 318, 90);
>
> run("Plot Profile");
> saveAs("Text", "C:\\Documents and Settings\\ Raw Files\\SC\\ 1b\\Row90
> back.txt");
> close();
> makeLine(1, 95, 318, 95);
> run("Plot Profile");
> saveAs("Text", "C:\\Documents and Settings\\ Raw Files\\SC\\ 1b\\Row90
> back.txt");
> close();
> makeLine(1, 100, 318, 100);
> run("Plot Profile");
> saveAs("Text", "C:\\Documents and Settings\\ Raw Files\\SC\\ 1b\\Row90
> back.txt");
> close();
> :
>
> Any insight would be greatly appreciated.
>
> Thanks
> Greg