ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

efficient finding elements in cluster arrays?

Hello there,

Say I have a cluster array. The cluster contains different data types, e.g. a boolean, a string and a number (see attached image).

How do I efficiently and elegantly search for the first element in that array that contains a certain number if I don't know the boolean or the string value of that element?

I know I can use a for loop to unbundle the cluster array into individual arrays of the different data types, and then search the so-created number array for the number I need. But I hope there's a nicer way to do it.

Thanks,

WEnte
0 Kudos
Message 1 of 3
(2,732 Views)
You wouldn't need to unbundle to create individual arrays.  Just iterate through the array of clusters and unbundle the elements.  Stop when you find a match in the number array.  The conditional For Loop with LabVIEW 8.5 would be slightly quicker as it would allow you to stop the loop early.
Message 2 of 3
(2,704 Views)
thanks for the quick reply! I was hoping a bit for something that'd allow me to search for clusters of the type "boolean whatever; 4; string whatever". Oh well, something to wait for in Version 9 (c;=

(this would allow to parse multi-parameter data a lot quicker IMO)

Conditional for loop sounds good. I haven't come around looking at all the new things that came with 8.x
0 Kudos
Message 3 of 3
(2,698 Views)