LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating nested loops

Hi!
I would like to list all Combinations of a list A and a list B (each containing 5 integers) in a third list C in order to get 25 combinations. I am intending to use nested loops so that on the first loop the second loop starts and then the result lets say list A + list B are listed in the list C. Is there any other way of doing this with Labview or I am on the right track?
 
Best Regards,
Hamid  
0 Kudos
Message 1 of 4
(2,960 Views)

You can use the polymorphic array math to accomplish this.  Inside of a single for loop, index Array A and add that to the entire Array B in one shot.  At this point, there are numerous ways to take the output.  Probably the simpliest is to reshape the output 2D array into a 1D array.  For better memory allocation, you can preinitialize a 1D array and replace elements in the for loop but in the end it accomplishes the same task.  See attached example (LV7.1.1).  Of course everything is dependant on what you are going to do with this, what operations, when and where the numbers come from.

Paul


Paul
Message 2 of 4
(2,950 Views)

Hi Paul!

Thank you for the time you spend on creating the file. I can see it is exactly what I need and I am going to study it carfully in order to learn Labview. I owe you One.

Regards,

Hamid

0 Kudos
Message 3 of 4
(2,933 Views)
I appreciate the kudos....You can best pay me back in the future by helping out others that will need help and guidance.  Most of us here are pretty rabid LabVIEW fanatics.... In fact, my last 3 jobs were landed on my LabVIEW abilities.  Good Luck and never hesitate to ask if you need help.

Paul
Message 4 of 4
(2,927 Views)