03-06-2019 03:58 AM
Hello everyone,
I am beginner in labview and at learning stage, i am using spreadsheet into array function as you can see in below picture 1, that i have attached. Actually i have 2 problems in this VI.
1- I am not getting first line of measured data into first row of array, for reference i have uploaded picture 2. And in array there is automatically generated {0 0 0 0} at last row in array , your can see in pictures 2.
2- In picture 1 i have mentioned the location of problem 2, i just want to put number into array but i do not know how can i do. The technique that i have used in this VI is working but not perfectly, i mean to say when i press run button its creates thousand of zeros in start of 1D array before getting my actual data. How can i fix this issue. please guide me i will be grateful to you.
Solved! Go to Solution.
03-06-2019 04:36 AM - edited 03-06-2019 04:37 AM
Hi Aitzaz,
why do you think you need to convert that string into a 4D array, when you just have a 2D array of values?
Change that array constant to just 2 dimension!!!
(Do you really need a Matlab script for that basic math? Use LabVIEW functions instead!)
03-06-2019 04:51 AM
1. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! You are just causing weird race conditions. Your data obviously ends each line with a Line Feed, so use that by just telling the VISA Read to read more bytes than you ever expect in a row of your data. And since your loop rate is now determined by the rate as which a line of data comes in, you can get rid of the wait in your loop.
2. You can process a single line at a time. So do (1), get rid of the Concatenate String, and change your Spreadsheet String To Array to output a 1D array (why you have a 4D array is beyond me). You can use Feedback Nodes or Shift Registers with Build Array to create your XY graphs.