LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve elements in 1-D array

Hi,
how do I get the values of certain sets of elements in an array? for example, in case 0, i want to retrieve values of all 20 elements in "set 0" in Time array. if i use array subset vi, index = 0, length = 20, it will return the same array, that is Time array with multiple sets of arrays. i tried to change it to cluster and use the "unbundle" vi, but i can only select the first value.
in case 1, I want to retrieve the first set of the values in cluster 49 when I execute the for loop first time, then the second set of cluster 49 the second time and so on. Am I doing the right thing using auto-indexing in the for loop?

Thank you very much
0 Kudos
Message 1 of 7
(3,207 Views)
Huh?:-)

Whatever it is your trying to do I'm quite sure I'll be able to show you how to do it, however it was not easy to understand what your aiming for.

You have an array of clusters. The clusters contain different numeric indicators. Now - do you want to access one of these indicators and make an array out of it's values from a segment of cluster array?

If that's what you want you can either do it by first getting the segment from the cluster array by using the
array subset function and then feed that subset into an auto-indexed for-loop where you unbunde the value you want and wire it out of the for-loop...That way you get an array containing all those values from the selected segment of the cluster array. A more effective way would be to use a for l
oop without auto-indexing, just calculate the length you want your segment, wire that to the N of the for loop...and then inside the loop use the index function to read the clusters (use a start offset and then add the loop index to get the current element) and unbundle the given values...Then wire the value out of the for loop with auto-indexing on to get the array..(there's other ways of doing it as well, but this is quite memory and speed efficient...). However, I'm not sure that's what your after(?).

One question byt he way, why do you read the cluster array by using a local? Why not just have it be a control and wire the array straigh...locals are mostly only necessary if you need to process something in two different parallell loops, and should be avoided especially when dealing with larger structures...like a cluster array.
0 Kudos
Message 2 of 7
(3,207 Views)
Thank you for your reply and sorry for the confusion, i am not familiar with the terms in labview.

for the first question, yes, i want to access the indicators and make an array from a segment of the cluster arrays. because for almost every one of cluster arrays, it usually repeats the same velues in the segments except the first value from previous segment is removed. for example, i have 5 variables in PolyFit cluster, then the segment 0 would have 5 values, the segment 1 would have 4 values with the first variable removed, the segment 2 would have 3 values and so on.
i only want the 5 values from 5 variables.
and i don't understand what you mean by inside the loop use the index function to read the clusters... you mean the "index and bundle cl
uster array" function?

i also attached the modified file if you want to take a look.

thank you very much
0 Kudos
Message 3 of 7
(3,207 Views)
Hello......... what is labview??
0 Kudos
Message 4 of 7
(3,207 Views)
When I say index inside the loop I mean as illustrated in the attached VI...
0 Kudos
Message 5 of 7
(3,207 Views)

What Is LabVIEW?
There are LabVIEW Training available, regional, onsite, online, and self-paced.
Zvezdana S.

0 Kudos
Message 6 of 7
(3,207 Views)
Thank you very much ... i got it
0 Kudos
Message 7 of 7
(3,207 Views)