Login  Register

Re: Help needed: Macro to save plot profile data as text

Posted by Peterbauer Thomas on Apr 27, 2015; 8:03am
URL: http://imagej.273.s1.nabble.com/Help-needed-Macro-to-save-plot-profile-data-as-text-tp5012614p5012619.html

On 2015-04-26 23:56, Silas Kraus wrote:
> I already got help from another ImageJ user who sent me a link to a very
> similar example macro that worked for me:
> http://rsb.info.nih.gov/ij/macros/GetProfileExample.txt

>> You are trying to save the plot, not the values. You have to get the
>> values into a results table:
>>
>> run("Clear Results");
>> profile = getProfile();
>> for (i=0; i<profile.length; i++) {
>>     setResult("Value", i, profile[i]);
>> }
>> updateResults;
>> saveAs("results","/path/to/file");
>>

> The strange thing is that this code still threw the same error. It only
> differs from the above mentioned example macro in one line: The
> "updateResults;" command is outside of the loop. When I put it inside
> the loop, everything works fine.

I cannot reproduce the error, neither with my code nor with the example macro. In the example macro, the "updateResults" command resides also outside the loop. There are just no curly brackets surrounding the "setResults" command, which means that only the first line following the for-statement (again only "setResults") is executed within the loop.


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html