LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1D Index Array Extraction

Solved!
Go to solution

Hey all,

 

I'm relatively new to using LabView and cannot figure out how to get this done.

 

I have 2 arrays, aray A and array B. I want to look up the specific values from Array B by analyzing Array A first and noting what locations, indexes, they are. 

 

From Array A I am able to locate the locations, but it is in the form of a 1-D array of double. Now that I know the indexes of locations in interest,how do I extract the data from Array B? 

 

 

When I try to use Index Array LabView gives the following error, 'source is 1-D array and sink is long'. Any help would be greately appreciated on how I can extract the data points from Array B by having an array of indexes of interest.

 

Example of what I'm trying to do

 

Input:

Locations / Indexes: 1  3  4

Waveform Array: 0  2   4  6  8  10

 

Output:

0  4  6 

 

 

 

Thank you for your time

0 Kudos
Message 1 of 4
(2,812 Views)

extraction.png

Message 2 of 4
(2,801 Views)
Solution
Accepted by topic author Chron0

Arrays are 0 indexed so locations 1,3, & 4 should be 0, 2 & 3 if you want those output values.  Attached is a pic of the code to do this. Be sure to disbale indexing on the data set and allow indexing on the 'location/indices' array. 

Download All
Message 3 of 4
(2,800 Views)

Thanks a bunch you guys. This was exactly what I was looking for! 

0 Kudos
Message 4 of 4
(2,781 Views)