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: 

Extracting elements from array X where the elements are specified from another array Y

Hello All,
I have an array X (say 10 elements) and an other array Y (say 3 elements). I would like to make a new array with the elements [x(y1), x(y2), x(y3)]. How do I do this most efficiently. In my problem the array sizes are large.

Thanks,
Karthik.
0 Kudos
Message 1 of 2
(2,293 Views)
See the attached subvi I made to do that for floating point values. The basic idea is to run both arrays into a For loop, but only auto-index on 'Y', the array of indices. Also use auto-indexing to generate the output array.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 2
(2,293 Views)