LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How a 2D array with a special structure can be reorganized?

How a 2D array with a special structure can be reorganized?

 

The 2D array is obtained reading an appended spreadsheet generated as result of next actions:
The measurement system uses a main variable (V1 having N_V1 measurement points ) and a secondary variable (V2 having N_V2 measurements steps).

The measurements are performed varying V1 in a loop of NV2 steps of V2 variable. The measurements are easy saved writing data in an appended excel file.

 

These data must be reorganized as following i)after  variable V1 values only ; the V2 values will be the labels of each set of measurements corresponding of v1values.

 

In figures 1 and 2 there are a 4meas.steps of V1 and 3meas.steps V2 results in initial and intended final excel file( the  final form(fig2)doesn’t  include the labels for V2)

 

Regards,

Mabel

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

Do you always know it is 4 steps repeated over and over in the first column?  Could it ever be different?  If it can change, will the user know what the number is or does your VI have to figure it out for itself.

I assuming the user knows it is X = 4 for the first column that is repeated.  You can do and index array to get the 0th column and the 1st column.  Do array subset to get the first 4 elements of the 0th column.  Take the #1 column and do a reshape array to that you have 4 rows, and the length of the 1-D array divided by 4 (call this Y) for columns.  Now you have a 4 row array you can build with the 4 row by Y column array.

0 Kudos
Message 2 of 3
(2,488 Views)
Hi, Thanks for answer. I know to solve the problem in case of a fix number of X variable (4 like in my example) but in fact this number is a parameter function of initial conditions applied… I am thinking that there is a possibility to write the program in a compact mode avoiding the use of a maximal case… Thanks, Mabel
0 Kudos
Message 3 of 3
(2,443 Views)