Login  Register

Re: FIJI macro function "split" not working

Posted by Wayne Rasband-2 on Jul 06, 2018; 4:27am
URL: http://imagej.273.s1.nabble.com/FIJI-macro-function-split-not-working-tp5020921p5020922.html

> On Jul 5, 2018, at 9:34 PM, Kaiming Yin <[hidden email]> wrote:
>
> Dear there,
>
> I was running FIJI on my Ubuntu 18.04 laptop and found the macro function
> "split" seemed to be not working anymore. For example, in a new macro, I
> wrote:

The split() function returns an array. This example shows how to print the elements of an array:

   a = "ImageJ v1.52e Ubuntu 18.04";
   print(a);
   b = split(a, " ");
   for (i=0; i<b.length; i++)
      print(i, b[i]);

This is the output:

   ImageJ v1.52e Ubuntu 18.04
   0 ImageJ
   1 v1.52e
   2 Ubuntu
   3 18.04

-wayne


> a = "ImageJ v1.52e \n Ubuntu 18.04";
> write(a);
> b = split(a, " ");
> write(b);
>
> write(a) worked well but write(b) ended up with an error report and debug
> window shown as below:
>
> a    *    "ImageJ v1.52e  |  Ubuntu 18.04"
> b    *    array[5]
>
> ---        ---
> Error:        '[' or '.' expected in line 5:
>        write ( b <)> ;
>
> Can I ask what can I do to fix my scripts please?
>
> Thanks,
> Kaiming

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