Login  Register

Re: Macro language question

Posted by Ben Tupper on Jun 08, 2008; 9:45pm
URL: http://imagej.273.s1.nabble.com/Macro-language-question-tp3695997p3695999.html

On Jun 8, 2008, at 5:08 PM, Wolfgang Schechinger wrote:

> Dear experts,
>
> I would like to use the loop variable of a for...next construct as  
> part of a filename, which should look like file[number].txt
>
> How to achieve that? Is there something like the STR$(var) command  
> from BASIC to convert numbers into strings?
>


Hi,

You should be able to direct "pasting" as ImageJ's interpreter will  
cast the number to string like this...

for (i=0; i<5 ;i++) {
        f = "myfile_" + i + ".txt";
        print(f);
}


But you can also use the macro function toString().  See ... http://
rsb.info.nih.gov/ij/developer/macro/functions.html#T

Cheers,
Ben



Ben Tupper
[hidden email]

I GoodSearch for Ashwood Waldorf School.

Raise money for your favorite charity or school just by searching the  
Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!