LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save X and Y vaue from a Waveform Chart

Solved!
Go to solution

Hello Everyone!

 

I'm implementing an adquisition systems that send data to a waveform Chart through VISA. All run properly, but I would like to save the data adquired to an excel file. I saw examples to how to save it, but only save the Y value.

I would like getting the X and Y values in 2 columns different in the excel file.

 

¿Is it possible?

¿Can someone tell me how I can do it?

 

Thanks for your feedbacks! 

0 Kudos
Message 1 of 13
(3,166 Views)

what kind of plot is that, are you plotting a Y value w.r.t time or w.r.t change in input. You are saying that you read the data from VISA so the data o/p is Y. WHen you read the data you also can get timestamp which can be used as X value. In short at t=0 Y=Y1, t=T100 Y=Y100, is this what you are looking for?

0 Kudos
Message 2 of 13
(3,159 Views)

Hi!
This is!The value that I recieve through VISA are the values from Y scale. I can save these in excel, but I don't know how to save also de values from X scale. The pairs (XY) as you told me....


¿Can you help me? I don't know how implement timestamps...

 

 


Thanks for your feedbacks!

0 Kudos
Message 3 of 13
(3,150 Views)

You don't implement timestamps. A timestamp is a data type. If you are sending a waveform data type to a chart that datatype contains 3 elements: start time, delta T, and array of values. You can calculate any value of X based on an index. I.e., the X value for the 5th Y value (index = 4) would be 4*deltaT + start Time.

0 Kudos
Message 4 of 13
(3,144 Views)

Hi,
Ok! I understand... Can I find some example anywhere? I understand what are you saying to me, but I don't know how to send to excel file. 
Now I have a OK button that if you press it, then the value of waveform Chart (Y value) safe into a excel file (using write spreadsheet).


¿How can I do it?

 


Thanks for your sooner answer! 🙂

0 Kudos
Message 5 of 13
(3,139 Views)

What kind of example are you looking for? The Write to Spreadsheet File creates a delimited text file. In order to actually write to Excel workbooks you need to buy the Report Generation Toolkit or program Excel yourself using ActiveX. There is an example that ships with LabVIEW on writing a 2D array of data to an Excel workbook. You can find it by opening the Example Finder (Help - > Find Examples) and searching for Excel. There are also lots of examples on programming Excel in the Excel thread. NOTE: DO NOT POST QUESTIONS IN THE EXCEL THREAD. It is a repository of links only.

0 Kudos
Message 6 of 13
(3,133 Views)

Ok! I will see it now...

 

In my appplication now, I only save a 1D array coming from the Waveform Chart to the SpreadSheet, because I didn't know how to save both coordinates (XY) in array of 2D. This is why I 'm asking this...

 

Thanks for your feedbacks!

0 Kudos
Message 7 of 13
(3,130 Views)

What are you feeding the waveform chart? A waveform datatype or dynamic data? Can you post your VI?

0 Kudos
Message 8 of 13
(3,119 Views)

The waveform Chart is feeding by the data reicivied through VISA. Now, I only keep the Y information in array of 1D.  I want to get the value of X an Y from the waveform to an excel file. I would like to send this information (array 2D, because there are 2 datas) to the SpreedFile to write it to excel and have both information (time and amplitude).

 

Attached you will find the scheme I've made...

 

Thanks for your feedbacks.

 

 

0 Kudos
Message 9 of 13
(3,114 Views)

I meant uploading the actual VI, not a picture of it. You need to fix your code.

  • You should not be initializing the serial port in each iteration of the loop. Initialize outside, read in the loop, and close when the loop is done.
  • Why do you have 2 VISA resource controls? Are you talking to 2 different devices?
  • The event structure serves no purpose in your code. If you are trying to enable/disable the file writing, use a case structure that's controlled by a simple front panel switch.
  • You should "remember" the path that the Write to Spreadsheet File uses. Otherwise you will be asked for the filename each and every time you try to save. You can do this using a simple Feedback Node:
  • Since you are reading the value periodically, just use one of the Get Date/Time functions. You can use the Get Date/Time String to get a formatted string. Then you can format your value as a string, and build your array using those 2 values. Or, you can use the Get Date/Time in Seconds to get a numerical value. Be aware that LabVIEW's starting time is 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00], which is different from Excel. 
0 Kudos
Message 10 of 13
(3,109 Views)