From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

store column into matrix

Hello, I'm acquiring some data that comes into a string of numbers. I'd like to store them into a matrix in this way: for acquisition 1 -> data in column 1, acquisition 2->data in column 2 and so on...

 

I did the code attached simulating some data, but when I put them in the matrix, the new acquisition finishes in column 1 and the old one become a list of 0.

Any suggestion?

 

ps - I'm acquiring pixel values, so at the end I'd like a pixel matrix to reconstruct an image. every acquisition is a vertical line of the image.

0 Kudos
Message 1 of 12
(3,204 Views)

A matrix is a special datatype, mostly for linear algebra and other computations. You want to use a plain 2D array. Keep it in an initialized shift register and add a new row with each iteration using build array.

Message 2 of 12
(3,202 Views)

Thanks! I'll try that!

0 Kudos
Message 3 of 12
(3,200 Views)

Do you really need to see the imtermediary result? If the loops are fast, just autoindex on both loop to get a 2D array. Same final result.

 

0 Kudos
Message 4 of 12
(3,198 Views)

Do you have some example?

0 Kudos
Message 5 of 12
(3,197 Views)

Hem could you send me the .vi? Thaks!!!!

0 Kudos
Message 6 of 12
(3,182 Views)

It just export the last values of the 2 for loops...

0 Kudos
Message 7 of 12
(3,179 Views)

Check the attached vi. I recommend you to take LV basics and workout some example to get used to the primitives in LV.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 12
(3,175 Views)

Hi, could you tell me where is the error? thanks

0 Kudos
Message 9 of 12
(3,165 Views)

@Elena_vsc wrote:

Hi, could you tell me where is the error? thanks


Your VI looks nothing like my example. I cannot really tell what the error is, because you are not telling us what kind of result you get and what kind of result you expect. Do you get an error message?

 

  • You did not initialize the shift register (right-click the left side...create constant)
  • LabVIEW makes no distinction between row vectors and column vectors. so remove the smaller "build array" and the transposition. Transpose once outside the loop, after it leaves the right shift register. (and also going to the "appended array" indicator if needed). Make the "transposed array" a 1D array and resize it vertically on the front panel.
0 Kudos
Message 10 of 12
(3,157 Views)