FIJI macro function "split" not working

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FIJI macro function "split" not working

Kaiming Yin
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:

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
Reply | Threaded
Open this post in threaded view
|

Re: FIJI macro function "split" not working

Wayne Rasband-2
> 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
Reply | Threaded
Open this post in threaded view
|

Re: FIJI macro function "split" not working

Kaiming Yin
Thanks Wayne,

It works perfectly!

With best wishes,
Kaiming

On 6 July 2018 at 05:27, Wayne Rasband <[hidden email]> wrote:

> > 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
>

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