02-23-2020 02:56 AM
Hi,
I have a very basic doubt. I want to save the values of a waveform chart (both X and Y axis) in text file. Is there any way to save the data with time (in arbitrary unit)?
Also, 'write to spreadsheet' saves data of the format %3f i.e., upto 3rd place of decimal only. I want to save the numbers as the actually are (upto whatever place of decimal).
Can somebody please help?
I am attaching a VI based on the way I am trying to save the data.
02-23-2020 04:52 AM
You can right click on a graph when it has data in and open the 'Export' menu and select export to clipboard or excel.
The formatting does leave something to be desired if you do this.
Write to delimited spreadsheet is better, using the format string %#_g should result in what you want.
Personally I prefer using the 'Array to spreadsheet string' function and then write to file.
02-23-2020 05:31 AM
Actually I am having 2009 version of LabView, so this export option is not available there.
02-23-2020 07:28 AM - edited 02-23-2020 07:30 AM
02-23-2020 08:06 AM
Please suggest some way for saving a number in the waveform chart which is changing after each iteration (saving time values also).
02-23-2020 08:34 AM
So you don't want to save a large block of data, you want to save each individual datapoint as it is written to the chart. Am I correct?
Then open the file before you start, and use Write to Text File functions to save your data point.
To come up with the X (time) value, you need to realize a chart's X value is based on the T0 (initial time) and the dT (time between points). So if saving a large block of data from a chart, you'd need to create all your X values based on T0 and dT. You can do that in a loop.
Since you want to save the data a point at a time as it is written to the chart, just combine your current timestamp with the Y value you are sending to the chart and write that to the file.
02-23-2020 08:35 AM - edited 02-23-2020 08:36 AM
What do you want to be in your x axis? Whatever it is you need to create an array where column 0 is your x axis data and column 1 is your y axis data (Row 0 and Row 1 if you don't have the Transpose input of write to spreadsheet set to True). You then wire this into the 2D array of Write to Spreadsheet.
The x axis could just be iteration (In which case you can use the i terminal of your while loop) or it could be time elapsed/current time
Also, an observation, you are currently prepending each new value to the beginning of the array, this will result in the newest data been shown at the top of your file. Normally it would be the other way around, newest data at the bottom of your file. THat is up to you though
I am not entirely sure I understand your second question. It might be worth posting an example of your larger code.
02-23-2020 09:00 AM
Looks like I could not explain my problem properly. Here is the whole thing step by step:
Thank you in advance.
02-23-2020 09:04 AM - edited 02-23-2020 09:05 AM
02-23-2020 09:23 AM
Thank you for this detailed suggestion. So here is the concerned part of the code.
I am using the min value of a min max array as Y for waveform chart. But the build array function is taking the valu at 0th index only. So at the end, I am getting just one value (obtained from the last iteration).
Even if I ignore X values here, atleast Y values I need in a column.
Thank you