05-23-2016 04:53 PM
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.
Solved! Go to Solution.
05-23-2016 05:27 PM
Look up RESHAPE ARRAY in the ARRAY palette.
Collect the data as a 1-D array, then reshape it into 8x8.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2016 05:29 PM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2016 05:38 PM
-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?
05-23-2016 05:44 PM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2016 06:44 PM
Thank you 😄
it worked XD