LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store XY Graph data to text file

Hello,

I want to store data of my XY Graph into a file. But I have problems to replace that string correctly.
I want to replace the tab with ; but it only replaces the first tab. Also I want to fill the number that every number follows %5f (0,00000).
I attached a example.vi and a snippet of it. The example.wfm is the txt-file how it looks now after calling this vi.
Normally I get data of a XY Graph (case-structure). Its data I put in waveform.wfm which you should put to your clipboard, if you want to try the code.

 

I tried so many things. Like SEARCH & REPLACE STRING which only replaces the first line.
Also I tried to put the SPREADSHEET STRING TO ARRAY and afterwards ARRAY TO SPREADSHEET STRING. This only helped me with getting the string correctly formatted. But I only get one of the columns to my file.

Can anyone help me please?

Best regards,

Max30

Download All
0 Kudos
Message 1 of 9
(4,233 Views)

Hi Max,

 

I want to store data of my XY Graph into a file.

Why do you copy the XY graph content to the clipboard?

Why don't you just read the values of the XY graph using a property node?

Why do you need to use methods/property nodes at all? WHy not just wire the data directly to the saving routine?

 

Why not keep it simple:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(4,231 Views)

Hi GerdW,

thanks for your example. I had this before, but I didn't achieved what I want with that.
I am using the way over the clipboard, because I want to get a scaled waveform. I load this waveform and manipulate it with the built-in graph palette. I need this for a report, where I don't want to get the whole signal, only the part  which is interesting. I looked for a solution where I don't have to use that way. With direct wire of the xy graph to that, I get the whole x axis (4000 us) but I want only 2700 us (only an example). And I only manipulate the x axis.
Do you have a better solution to get only the scaled plot?


Best regards,

Max30

0 Kudos
Message 3 of 9
(4,213 Views)

Hi Max,

 

I still would use property nodes. You can also read the x scale settings using those nodes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(4,211 Views)

Hi GerdW,

but how I do it? How I get x and y like I have it in my example.wfm? I don't have any solutions.

Best regards,

Max30

0 Kudos
Message 5 of 9
(4,208 Views)

Hi Max,

 

How I get x and y like I have it in my example.wfm? I don't have any solutions.

Do you see my image above?

Using ArrayToSpreadsheetString will give you the XY coordinates formatted to string…

All you need are those X and Y arrays (or an array of points)!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(4,197 Views)

Hi GerdW,

I see your picture. And this works fine. But it saves all data points of the original waveform. When I use the built-in graph palette to only see the waveform between 0 and 2000 s I get in the text file the original 4000s. And I ONLY want the visible 2000s of the plot. I can't find any property node where I get the expected  values.

Best regards,

Max30

0 Kudos
Message 7 of 9
(4,194 Views)

Hi Max,

 

use propertynodes to read the x scale settings. There even is an event in case the scale changes.

Then use the x scale min/max to limit your data points.

(I usually do the data filtering/decimating) on my own, displaying just the filtered data in the graph. This way you would have solved your problem even before you display the data.)

 

Your points seem to be sorted by x. Is this really the case?

If the data is sorted this would help:

check.png

As said before: I do the filtering of the data before displaying on the graph, so I don't need to read any property nodes later on. A graph should be used as data sink (aka indicator), but not as data buffer…

 

On your original question:

But I have problems to replace that string correctly. I want to replace the tab with ; but it only replaces the first tab.

Did you read the help for the SearchAndReplace function? Did you tried to wire all neccessary inputs?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(4,191 Views)

Hi GerdW,

thanks for your possible solution! I try it with this.

As said before: I do the filtering of the data before displaying on the graph, so I don't need to read any property nodes later on. A graph should be used as data sink (aka indicator), but not as data buffer…

The user want to reload previous waveforms to scale it (--> put it in that XY Graph) and afterwards to put it correctly in a report. The user don' want to scale the waveform while measuring with the oscilloscope, so I have to implement a possibily to customize these sets of waveforms.

Did you read the help for the SearchAndReplace function? Did you tried to wire all neccessary inputs?
I did it and funnily it only worked correctly for the first row. But with your first solution I get the data points in that text file how I want it. So this is no more a case here.

Best regards,

Max30

0 Kudos
Message 9 of 9
(4,182 Views)