LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving waveform with 2 components

Solved!
Go to solution

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.Program.JPG

Any help is greatly appreciated 🙂

0 Kudos
Message 1 of 6
(2,994 Views)
Solution
Accepted by topic author chrislee1

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 6
(2,958 Views)

Hi, 

  Can you make this VI to backward compatible with labview 14 ?

Best Regards,
Dhans 😉
Kudos are welcome 😉
Aspirant Labview Programmer (Labview 14) 😉
0 Kudos
Message 3 of 6
(2,957 Views)

No problem! Here you go.

Message 4 of 6
(2,949 Views)

Thanks..!

Best Regards,
Dhans 😉
Kudos are welcome 😉
Aspirant Labview Programmer (Labview 14) 😉
0 Kudos
Message 5 of 6
(2,946 Views)

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

0 Kudos
Message 6 of 6
(2,932 Views)