01-08-2017 10:30 PM
Hi,
I am a student and am new to labview. I have written a data aquisition program to log data from a COM port (device sends 2 types of data, data1 and data2). I figured out how to save a .csv with time in the first column and data1 in the second column. I am trying to save a thrid column in the csv file with data2. I have attached my vi.
Any help is greatly appreciated 🙂
Solved! Go to Solution.
01-09-2017 12:59 AM - edited 01-09-2017 01:21 AM
Hi ChrisLee,
a waveform ony contains one Y array - you cannot store two "components" in a waveform!
But you could create an array of waveforms easily…
While an array of waveforms may solve your issue it is IMHO not the right way to tackle your problem:
A CSV file is merely a 2D array of data. When you put your data in a 2D array (with the needed number of columns) you could easily use WriteToSpreadsheetFile to create your data file! And you could add as many "data" columns as you want…
(Using any ExpressVI like FromDDT to be able to use Waveform functions is one indication you are using the wrong functions… :D)
Btw. I really like it when VIs are cleaned up (using AutoCleanup) before posting images.
On your VI:
- Why can you stop one inner loop, but not the other?
- Why can't you stop the outer loop?
- Why do you use local variables so much?
- Why do you need to convert number to string, append those strings and convert the string back to number? Why not use simple math like "y=a1*x1 + a2*x2"? Or a JoinNumber operation?
01-09-2017 12:59 AM
Hi,
Can you make this VI to backward compatible with labview 14 ?
01-09-2017 01:06 AM
No problem! Here you go.
01-09-2017 01:09 AM
Thanks..!
01-09-2017 01:32 AM
Hi GerdW,
- Why do you use local variables so much?
Local variables was the only way I managed to communicate between the two loops. I need to use two loops because the timing on the microcontroller is not steady, plus I can view the data when adjusting my experiment setup. Is there a better method to communicate between two loops?
- Why can you stop one inner loop, but not the other? Why can't you stop the outer loop?
I could not figure out how to stop the loops properly. When I stop a loop, the boolean saves the last clicked value (eg true). So when I start the loop again, it instantly exits. I truly believe there is some better way of structuring the program, but I don't have any programming background.
- Why do you need to convert number to string, append those strings and convert the string back to number? Why not use simple math like "y=a1*x1 + a2*x2"?
This part of the code was written because HEX is more convenient for microcontroller debugging. Debugging is done now. I can take that part out. Thanks for pointing it out 😄
Cheers,
ChrisL