Re: Array.deleteElement within macro language

Posted by Gabriel Landini on
URL: http://imagej.273.s1.nabble.com/Array-deleteElement-within-macro-language-tp5021937p5021944.html

On Friday, 29 March 2019 16:56:10 GMT [hidden email] wrote:
> "Please forgive me if this is obvious."
>
> Wayne's examples show that the mechanism is always value-based-

Hm...I am confused too.

I think the explanation may not be correct:

>> Thanks to Norbert Vischer, the ImageJ 1.52o7 daily build adds an
>> Array.delete(array,value) macro function that can be used to delete
>> array elements by value or by index.

According to the examples it is only "by value" and not "by index"?

For example if I want to delete the 5th entry in the array (i.e. "by index"):
a1 = newArray(0,2,2,2,4,6,8,8,8,10)
w = Array.delete(a1, 5);
Array.show(w);
0
2
2
2
4
6
8
8
8
10
- - -
The 5th element is "6" but I guess the delete function is looking for value
"5", which is absent, so the 5th element does not get deleted.

Cheers

Gabriel

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