LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to put 58 columns of data into an array in one shot?

I have a set of data with 58 columns and 5000 rows. However, I need to find offset for all the elements in this 5000x58 set of data. Is there an easier way to put all the data (offset) into an array in one shot other than using build array function? This is because if I use the build array function, I will need to separate all the data into 58 columns by indexing them. This is too time consuming.

 

Thanks for the suggestion! Have a good day! 🙂

0 Kudos
Message 1 of 11
(4,475 Views)

How are you planning to find the offset? Do you have any reference value? It would be good if you can post the code that you have developed (In 2011 version please).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 11
(4,445 Views)

@VanessaWen wrote:

This is because if I use the build array function, I will need to separate all the data into 58 columns by indexing them. This is too time consuming.


Why not just use an autoindexing FOR loop?

 

But the heart of your problem is what is the mathematical definition of offset?  Once we have that, then we can get somewhere.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 11
(4,428 Views)

@VanessaWen wrote:

I have a set of data with 58 columns and 5000 rows. However, I need to find offset for all the elements in this 5000x58 set of data. Is there an easier way to put all the data (offset) into an array in one shot other than using build array function? This is because if I use the build array function, I will need to separate all the data into 58 columns by indexing them. This is too time consuming.


You need to explain in much more detail, because your problem is not clear.

 

Is this a 2D array with 58 columns and 5000 rows?

What is your definition of "offset"?

Where does the offset value come from?

Is "offset" it the same for each row (or column) or does it depend on the data?

What is the definition of "one shot"?

Why would you need to seperate all the data into columns in order to use build array?

It it "too time consuming" to write the program or is the execution slower than expected?

Is the final output a 1D or 2D array or something else?

 

Please attach a VI containing a small 2D array diagram constant with typical data, then show us what kind of output you would expect after applying the described operation.

 

0 Kudos
Message 4 of 11
(4,398 Views)

If the formula is the same to compute the offset across your 5000x58 matrix, then why not use simple numeric functions to do it in "one shot"?


Kudos are the best way to say thanks 🙂
0 Kudos
Message 5 of 11
(4,379 Views)

Hi Altenbach,

 

The data is obtained through DAQ and it consists of 58 columns and 5000 rows. Each column represents one type of data. For eg, column 1 is current, column 2 is voltage.

 

For type of data, there will be a desired value input by the user. The offset will be obtained by subtracting the data obtained through DAQ from the desired value.

 

My idea is to extract the data element by element from each column. When the last element of each column is reached, the program will extract the data from the next column.

 

However, I am not sure exactly how to implement this idea.

 

Hopefully this explaination is detailed enough. So sorry for not being able to elaborate in detailed in the first post.

 

VanessaWen

0 Kudos
Message 6 of 11
(4,336 Views)
The subtract function accepts an array as an input and the other input will accept a scalar so you just have to index a column to subtract your user value from all elements. You can index all columns at once and do the subtractions in parallel.

How are you planning to have 58 different controls for the user?
0 Kudos
Message 7 of 11
(4,330 Views)

@VanessaWen wrote:

 

For type of data, there will be a desired value input by the user. The offset will be obtained by subtracting the data obtained through DAQ from the desired value.


See my confusion? Initially you said you "need to find" the offset, now you are saying that the user enters the offset.  Does this mean you have a 1D array of 58 offsets, one for each column? How is the user supposed to enter all those?

 

In any case, once you have that array of offsets, place a single subtract node inside a FOR loop. Now transpose the 2D array and autoindex both arrays (2D transposed data and 1D offsets) on the left loop boundary, subtract the scalar offset from each colum, autoindex again at the right boundary and transpose again to generate the adjusted 2D array.

0 Kudos
Message 8 of 11
(4,312 Views)

Hi Dennis,

 

That's what I am doing now: Index all columns at once and do the subtraction at once. However, I feel that it is not efficient.

 

The desired values are input by the user, it's just a numeric control.

 

VanessaWen

0 Kudos
Message 9 of 11
(4,233 Views)
What makes you think it is inefficient? Post your benchmark and performance figures.

Do you mean you have 58 different controls?
0 Kudos
Message 10 of 11
(4,228 Views)