Login  Register

Re: continue equivalent on macro language (for loop control)

Posted by Gluender-4 on Mar 16, 2011; 2:58pm
URL: http://imagej.273.s1.nabble.com/continue-equivalent-on-macro-language-for-loop-control-tp3685375p3685376.html

Carnë,

perhaps you should get more acquainted with the IJ macro language:

macro "Test [t]" {
        a = newArray( 3 );
        testFunction( a );
        print( "Values: " + a[0] + " " + a[1] + " " + a[2] );
}

function testFunction( a ) {
        for ( i = 0; i < 3 ; i++ ) {
                a[i] = i;
        }
}


>On 16 March 2011 11:48, Gluender <[hidden email]> wrote:
>  > Carnë,
>>
>>  did you consider using functions to make your (smart) code more structured?
>
>I did. But then I can't return more than one value from a function. I
>could return an array so I tried it despite the limited array
>manipulation functions but I get an error saying that an array of
>arrays is not possible. That said I did made a few functions (mostly
>for array manipulation) but not nearly as much as I would like to. I'm
>trying to make the code the easy to read since I'm not writing it for
>myself, but for people in the lab who don't know programming and I
>don't want to scare them away even more from looking at code.
>
>
>On 16 March 2011 12:15, Albert Cardona <[hidden email]> wrote:
>>  Macro recording and macros in general are great for specific tasks
>>  that can be applied to individual images, and are suitable for batch
>>  processing. For complex programs I'd go for a language that makes
>>  shuffling data around easy. For example python.
>
>Yeah, I feel like I'm using an axe for doing surgery. I was trying to
>avoid it because I thought that macro would be easier for
>non-programmers (the real users of it) to read and thus incentive them
>into tweaking and maybe creating their own macros. But I've been
>delaying learning Python for ages so this may be a good time. If only
>there was perl support as well...
>
>
>Still, thank you all for you comments.
>Carnë

HTH
--

                   Herbie

          ------------------------
          <http://www.gluender.de>