LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delete all odd index

can someone help with with this?
how do i delete all odd indexes?

that means that i have an array of 20 elemeents for instant..
i want to keep index 0,2,4,6,8,10,12,14,16,18,20

i want to delete 1,3,5,7,9,11,13,15,17,19

can someone please help.
thanks in advance
Best regards,
Krispiekream
0 Kudos
Message 1 of 30
(5,353 Views)
Use "decimate 1D array", resize for two outputs and only use the upper output. It will contain your desired data. 🙂
 
(btw, your sample array contains 21 elements, so the output will be 0,2,4,...,18).


Message Edited by altenbach on 03-03-2008 10:00 AM
Message 2 of 30
(5,342 Views)
thank you!!!
you are the best!
Best regards,
Krispiekream
0 Kudos
Message 3 of 30
(5,335 Views)

Hello,

See the attached example. i made a simple thing to show you how to do that.

 

Software developer
www.mcm-electronics.com





PORTUGAL
Message 4 of 30
(5,332 Views)
i have version 8.0..
can you save as 8.0?
thanks

Best regards,
Krispiekream
0 Kudos
Message 5 of 30
(5,313 Views)
hello again,
 
I believe that's not need for that. Using decimation it's a much smart approach. i was reading all the index of the 20 elements array, then when the remainder of (index/2) = 0, then I save the result.
Software developer
www.mcm-electronics.com





PORTUGAL
Message 6 of 30
(5,302 Views)
"
Use "decimate 1D array", resize for two outputs and only use the upper output. It will contain your desired data.
"
 
Hmmmm
 
And I was thinking re-shape-array and index out the desired row (collumn).
 
Is the decimate method faster?
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 30
(5,291 Views)
Decimate seems to be about twice as fast.
Message 8 of 30
(5,279 Views)


Ben wrote:
And I was thinking re-shape-array and index out the desired row (collumn).
Is the decimate method faster?

While older version of LabVIEW had a cryptic note in the online help that the reshape operation does not move data in memory, I have never found that to be true when displaying buffer allocations.
 
So, by just counting the black dots, the decimate version is the clear winner. Even more so if we consider (1) diagram real estate, (2) the potential for coding errors (its easy to mix up the index terminals), and (3) diagram readability. 😄
 
As you can see, the reshape version allocates 2.5N, while the decimate version requries only 1.5N
 



Message Edited by altenbach on 03-03-2008 11:24 AM
Message 9 of 30
(5,276 Views)

Dratz! Smiley Mad

That Wizard beats me every time (except once!). Smiley Very Happy

If I keep trying, I may do it again, ..... some day.

Ben

"I think I can, I think I can, I think...." 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 30
(5,268 Views)