05-04-2013 01:01 PM
Dear Forum Members,
With reference to the attached LabVIEW 2010 Student Edition file....
From the incoming data via the .csv 'Read From Spreadsheet' I want to display an array of the difference between the n and n-1 data value i.e. if the data set is 10, 20, 25, 35, 50 then the difference will be 10, 5, 10, 15.
I have used the 'Index Array' function to extract the n and n-1 data values (using the 'Simulation Time' function as the Index Row incrementer) however I cannot find the way to build an array of these difference values and display them in the Front Panel i.e.
10
5
10
15
This will no doubt be a trivial issue for those more experienced LabVIEW programmers. Any advice or assistance will be gratefully received.
Kind regards,
Solved! Go to Solution.
05-04-2013 01:39 PM
/Y
05-04-2013 01:53 PM
Thanks for your response however when I tried to implement your idea there are several problems (see attached)
05-04-2013 03:07 PM
You are working with a 2-D array in your VI, yet you describe a 1-D array in your question. So what do you want to do with a 2-D array?
Rather than working in a For Loop, you could take a subset of the original array starting at the second element and subtract it from itself.
05-04-2013 04:05 PM
Basically you can put my code inside a for-loop, then it'll extract each row and do the calculations on that. Is that what you want to do? Else you can Transpose the array if it's the columns you want to calculate ...
/Y
05-05-2013 04:49 AM
I'll explain what I want to do again for clarity....
I have a simple spreadsheet file (in .csv format) that contains one (1) column of data x 800 rows (thats 800 elements). I read the data into LabVIEW via the 'Read from Spreadsheet' function (I have already established this). I then want to make an array that is the difference beween the n and n-1 data value. Hence if the data set is 10, 20, 25, 50... then the difference will be 10, 5, 25..
I want to display the difference array to screen in an indicator that shows all the difference values in one (1) column x 799 rows. Hopefully that explains what I want to achieve.
I tried the suggestion with the loop however there were multiple errors when this was attempted. I cannot place the loop within the simulation frame (it doesn't allow it) hence its outside.
Please excuse my inexperience concerning the array order(s), I find LabVIEW to be particularly unfriendly in this respect and its the source of much of my frustration and pain whenever I'm using LabVIEW to implement anything.
Regards,
05-05-2013 10:30 AM - edited 05-05-2013 10:30 AM
Since you have 1 column by 800 rows, then use Index Array first to get only the first column. This will give you a 1-D array of 800 elements. Then the idea of using that array, along with array subset for the 2nd through remaining rows, subtract one from the other, will work.
I can't comment on simulation loops because I don't have that and have never used it.