LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

executing a for loop using an array and an array of clusters

Hi All 

I have a problem where i need to obtain a string for each execution of the for loop and also executing for the amount of elements in the array of clusters. so for an array holding 5 elements and the array of clusters holding 3 elements i would like an output of 18 elements/strings. I have a solution but it is very bulky(using a for loop for each index of the array of clusters, executing for each element in the array of strings) is there any way to do this using only one loop?  

My solution is attached

Thanks

0 Kudos
Message 1 of 3
(2,694 Views)

I assume you made a typo as 5x3 = 15 not 18.

 

You could multiply the two dimensions together (5 and 3) and wire that to the N terminal of the for loop. You can then use 'index' array instead of auto-indexing tunnels to pick out the appropriate item from each array (e.g. using quotient and remainder) and do your operation.

 

Edit: Oh, having actually looked at your screenshot - why don't you have a for loop inside a for loop? (sorry, I thought you already had that and were trying to avoid it).

 

Also - if you create a subVI, you'll only need to edit the string manipulation once!


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 3
(2,689 Views)

Yes, all you need is a stack of two FOR loops. Now just build the parts in the inner loop and append.

 

 

(If your version is older, you might have to use shift registers instead of special tunnels.)

Message 3 of 3
(2,653 Views)