Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save data into .csv file while having a serial communcation

I am working on a project since very long in which I want to serial transmit the data and plot it to graphs and later on save the whole data to .csv file but right now I am able to serial transmit and plot the data but not able to save it into .csv file only the last data is saved into it.

I want that as the data is plotted into a graph it also get saved into .csv file
please help me out  

serail coming is in format of 

123,456,789,5.235

delay(1000);

I want each data to be plot on different columns and than start following it from the second row with the same column (i.e same filed of data to be plotted in same column 

0 Kudos
Message 1 of 4
(3,435 Views)

Look into using a Producer/Consumer setup.  The idea is to use a second loop for the logging and data is sent to it via a queue.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(3,364 Views)

Your picture code does not provide enough details. However, I normally use shift registers on while loop and build the array inside. Once you have array you can plot using XY graph and save in .csv worksheet using write to spreadsheet function. you may find following tutorial useful: https://www.ni.com/docs/en-US/bundle/labview/page/shift-registers-passing-values-between-loop-iterat...

0 Kudos
Message 3 of 4
(3,337 Views)

If you Right Mouse Click on the points where one of your DBL data points leaves your WHILE LOOP, you will note that it is setup as Last Value in Tunnel Mode.  That is the reason you are only saving the last point. To have all of the data available and saved to your csv file, you will need to change that from Last Value to Indexing. 

 

After you Build your Array (It will now be a 2-D Array), you will probably need to Transpose it in order for the data to be viewed and saved properly.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 4 of 4
(3,328 Views)