Login  Register

Re: Confused writing a macro

Posted by GDC on Nov 10, 2009; 7:17pm
URL: http://imagej.273.s1.nabble.com/Confused-writing-a-macro-tp3690490p3690492.html

Hi Michael

Thanks for your help.  I'm still not completely clear on the issue.  Are you saying I need to call another macro named PlotGetValuesDemo from within the macro I'm trying to write?  If so, I don't have this macro on my machine and i can't find it on the ImageJ download site.  I get an invalid filename if I incorporate the text as you've described into my macro.  i am new to writing my own macros so please bear with me if my questions are not very sophisticated.

Thanks
Greg


-----Original Message-----
From: Michael Schmid-3 [via ImageJ] <[hidden email]>
To: GDC <[hidden email]>
Sent: Tue, Nov 10, 2009 12:52 pm
Subject: Re: Confused writing a macro

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



View message @ http://n2.nabble.com/Confused-writing-a-macro-tp3981266p3981437.html
To unsubscribe from Confused writing a macro, click here.