LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store analog (arduino) data in a 2D Matrix

Solved!
Go to solution

Hi,

I need to store analog data in a 2D Matrix. I cannot use 2 for loops, since I receive complete data after the completion of both loops. So I need to use 1 for loop and store my analogue data in a 8x8 Matrix in that loop. (One for loop so I can store data in run time and I dont have to wait till the end of for loop.)

if you any idea how I can achieve this please let me know.

0 Kudos
Message 1 of 6
(3,779 Views)

Look up RESHAPE ARRAY in the ARRAY palette.

Collect the data as a 1-D array, then reshape it into 8x8.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 6
(3,770 Views)
Solution
Accepted by topic author maleee

OR

 

Initialize a 2-D array

 

integer divide the "i" of your loop by 8.

 

Use the remainder as the column index, and the quotient as the row index, and replace data at that R/C index with new data.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 6
(3,765 Views)

-OR

-Initialize a 2-D array

-integer divide the "i" of your loop by 8.

-Use the remainder as the column index, and the quotient as the row index, and replace data at that R/C index with new data.

 

For this, how will I store data? I mean I am getting serial data, how to store in a matrix? like the above logic you mentioned i.e. first store in array then convert it in matrix?

0 Kudos
Message 4 of 6
(3,760 Views)
Solution
Accepted by topic author maleee

Create your 2-D array ahead of time, and populate it with zeroes, and feed it into a SHIFTREG on your loop boundary (from outside).

With each sample (inside the loop), divide the "i" of the loop by 8 and use the quotient and remainder as indexes into a REPLACE ARRAY SUBSET operation.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 5 of 6
(3,756 Views)

Thank you 😄

it worked XD

0 Kudos
Message 6 of 6
(3,740 Views)