From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove elements of an array based on this index A+i*B order

Let's say I have 36 elements in my array and I would like to delete elements 10,11 and also 10+i*12 and 11+i*12

I mean for example  10,11,22,23, 34 and 35  when i starts from 0 to 3

What is the simplest way to implement this

 

0 Kudos
Message 1 of 3
(2,523 Views)

You'll need a For Loop.  You'll need a shift register to maintain the array between iterations as you proceed to delete each element.

 

I'd recommend deleting the last elements first because if you delete an earlier element, all of the index values of the later elements will shift forward by 1.

0 Kudos
Message 2 of 3
(2,514 Views)

This code actually conditionally (re)builds the resulting array rather than deleting elements, which provides the same effect.

 

Remove Array Elements.png

Feel free. Contact me for anything more,
    Pang

You too can be LabVIEW Awesome!
0 Kudos
Message 3 of 3
(2,505 Views)