From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Adding an element in an array of cluster of 2 elements

Hi all,

I have a 1D array containing a cluster of 2 numeric elements (= 2 rows of 100 values).
From this array, collecting new data in for loop, I want to create another array containing a cluster with 9 elements: in each for I want to add an element (= like one row).

After this, I want to compare data from one element with a fixed value, and when the value is find in the element, I want to extract the values of the 8 other elements at this point.

Thanks

Dze
0 Kudos
Message 1 of 4
(2,889 Views)
In my honest opinion, it should be better to use a 2D array for that, you could use indexing capabilities to extract data, build array with a shift register to add data you want in every loop, and search 1D array (previously extraccting the row you want) to select the column index, and take out your necesary 8 points. Clusters only make things more difficult. Is this possible? Else, we can try your way.
0 Kudos
Message 2 of 4
(2,889 Views)
Thanks for the answer,

I have extracted the cluster (containing 2 elements) from the 1d array, but after unbundling the cluster, I have just the 2 last values (1 for each element). Those 2 elements contain each 200 values in the 1d array. One element is the frequency and the other is a parameter which changes with each iteration in a for loop.

Extracting data and creating a 2d array: How could I put on the first dimension the first element (=frequency, with all 200 values) and on the second dimension the second element (containing the 200 values, answers to frequency values)?

And after, adding to the 2d array without increasing its dimension: for each iteration, add a column with the new second element (with its 200 values) and make it correspond to the frequency (already in
the 2d array)?

Thanks

Dze
0 Kudos
Message 3 of 4
(2,889 Views)
Sorry I didn't understand you well. To use only arrays, you'll need 3D arrays, as you can see in the example attached. I've made two variants, one with your method (don't know if there's an easyer one) and one with the method I think is easyer, after that, you can search in the 3D array easyer that in the array of clusters of arrays (uff...). If I misanderstood you again, please let me know.
Hope this helps
0 Kudos
Message 4 of 4
(2,889 Views)