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: 

handle array in multiple for loops

having issues with building a 2d array given the following set up.

for loop1 controlling number of times internal should run

for loop2 controlling number of different operations attempting to run.

i am attempting to come up with a 2d array that will give me

unit1 data array1 data array2 ...

unit2 data array1 data array2...

etc

any help would be appreciated

0 Kudos
Message 1 of 15
(2,912 Views)

It is hard to know what you are asking for by your description.  (Actually it is hard to know when a sentence begins because you never used capitalization!)

 

If you attach a VI that shows what you've attempted so far, it can help give us a clue as to what you are trying to do.  Particularly if you can give us some input data and an example of what the output data should look like.

0 Kudos
Message 2 of 15
(2,889 Views)

If you use auto indexing on both loops, and start with a single numeric datapoint from the inside loop, then the output of the inside loop will be a 1D array (you can call it a row or a column, it doesn't matter it's 1D). The output of the outside loop will be a 2D array with each row representing the 1D array from the inside loop.

0 Kudos
Message 3 of 15
(2,881 Views)

Issue i have with that is I am attempting to build the internal 1D array continually. I am trying to use a simalar structure to the attached to build a incrometable list of measurments based on number of units selected (internal for loop) and a fixed number of "operations" (external loop) that will have a "inconsitant" number of measurments

0 Kudos
Message 4 of 15
(2,878 Views)

That confuses things even more.  You've got 2 For Loops, but also 2 while loops.  You've got an awkward way of ending a loop with links like Stop when 2 < i.  Seems almost backwards way of saying you wan tthe loop to run 4 times (when i goes 0, 1, 2, 3).  So why not make the while loops into For Loops.

 

Indexing an empty array, then inserting into that array.  With a build up of a 1-D array in the middle of that.   And repeating all that 3 times concatenating the results.  It all seems very convoluted.

 

Post what you want the final array to look like.  It will be much easier to determine the right combination of loops and build arrays to handle that.  (And I doubt you would need either hte index array nor the Insert into Array.

0 Kudos
Message 5 of 15
(2,873 Views)

yes that is the structure i need to operate.  i am looking to generate a file that is as follows

 

unit 1 (Measurment array 1), (Measurment array 2), (Measurment array 3)...

unit 2 (Measurment array 1), (Measurment array 2), (Measurment array 3)...

unit 3 (Measurment array 1), (Measurment array 2), (Measurment array 3)...

 

I am using the external for loop to dictate generate measurment array counts and the internal to dictate number of units.

 

Purpose of the while loop is to allow multiple measurments on based on a condition dictated by external loop. so its going to be a measure while time allows condition

0 Kudos
Message 6 of 15
(2,869 Views)
0 Kudos
Message 7 of 15
(2,863 Views)

I am actually looking for a 2d array as my output.. Again my unit control is the internal loop... once unit is selected I need to append data to an array and I am looking to build back on to the same array x number of times based on the outside loop.

 

Maybe this will help with in the intended output file

unit1 - aaaaaaa bbbbbbb ccccccc

unit2  -aaaaaaa bbbbbbb ccccccc

etc

unit names wont actually be plotted just to show reference of what is creating data

 

0 Kudos
Message 8 of 15
(2,859 Views)

Okay,  So do this.

 

 

0 Kudos
Message 9 of 15
(2,845 Views)

Thanks for the attempt however that still wont meet what i need...

if i disable auto index and select index baesd on interger this will provide the data i want but it will make it as a 3d array. i will look into re-formatting the 3 d array as a 2d array

0 Kudos
Message 10 of 15
(2,838 Views)