Re: Creating multiple Arrays with for buckle

Posted by Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/Creating-multiple-Arrays-with-for-buckle-tp5011602p5011603.html

On Feb 15, 2015, at 3:34 PM, William Nicolas <[hidden email]> wrote:
>
> Hello everyone,
>
> I am actually working on a macro for fluorescence intensity quantifier, and I would like my macro to create for each image a new Array with serial names. i.e I want to analyze two images, thus I want 2 arrays for saving the intensity levels named something like ArrayImage1, ArrayImage2. I was thinking of doing this with a for buckle but I don’t know how to increment the name of the Arrays.

There isn’t a way to create multiple arrays named array1, array2, … arrayn, where n is a variable, but you can easily create a Results table with n columns. Here is an example:

  n = getTime()%10 + 1;
  run("Clear Results");
  for (i=1; i<=n; i++) {
     for (j=0; j<10; j++)
        setResult("Image"+i, j, random());
  }

-wayne








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