Re: Array.deleteElement within macro language

Posted by Wayne Rasband-2 on
URL: http://imagej.273.s1.nabble.com/Array-deleteElement-within-macro-language-tp5021937p5021952.html

> On Mar 27, 2019, at 7:06 AM, Philippe CARL <[hidden email]> wrote:
>
> Dear all,
>
> Would there be an interest for having an "Array.deleteElement(array, index)"
> entry within the macro language methods?

Today’s ImageJ daily build (1.52o9) adds the Array.deleteValue(arr,value) and Array.deleteIndex(arr,index) macro functions. The following example macro shows how to use these new functions.

-wayne

    // delete a numeric value
    a1 = Array.getSequence(7);
    Without3 = Array.deleteValue(a1, 3);

    // delete a string value
    a2 = newArray("one", "two", "three", "four");
    WithoutTwo = Array.deleteValue(a2, "two");

   // delete using an index
   a3 = Array.getSequence(5);
   Array.reverse(a3);
   WithoutIndex1 = Array.deleteIndex(a3, 1);

  Array.show(a1, Without3, a2, WithoutTwo, a3, WithoutIndex1);

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