Re: Array.deleteElement within macro language

Posted by Kenneth Sloan-2 on
URL: http://imagej.273.s1.nabble.com/Array-deleteElement-within-macro-language-tp5021937p5021949.html

And if, for some reason, a22 already contains some NaN values that you do NOT want
to remove?

I suspect that "remove by value" is actually implemented, but "remove by index" is
problematic.

Wayne's example appears to assume that there is a known value (NaN) which cannot
possibly occur in the Array.  This will work every time, until the middle of
an important demo to the funding agency.

I would prefer a specific function to remove an element by index.

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.





> On Mar 29, 2019, at 13:40, Herbie <[hidden email]> wrote:
>
> Hmm,
>
> I understand that you need some more lines for "index-delete":
>
>   // delete using indexes
>   a2 = Array.getSequence(10);
>   a22 = Array.copy(a2);
>   a22[5] = NaN;
>   a22[6] = NaN;
>   without5and6 = Array.delete(a22, NaN);
>
> Maybe I'm wrong.
>
> Best
>
> Herbie
>
> :::::::::::::::::::::::::::::::::::::::::::::
> Am 29.03.19 um 19:37 schrieb Gabriel Landini:
>> On Friday, 29 March 2019 18:32:14 GMT [hidden email] wrote:
>>> Good day Gabriel,
>>>
>>> did you follow the examples given by Wayne?
>> Yes, of course, :-) and I also read the explanation of what the command does
>> and I think something is not right:
>>>> Array.delete(array,value) macro function that can be used to delete
>>>> array elements by value or by index.
>> Note the "or by index" at the end of the sentence.
>> Regards
>> Gabriel
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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