LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using write waveforms to file vi

Solved!
Go to solution

What file extension do I use when using the write waveforms to file vi?

 

I ultimately want to use the file in MATLAB

Thanks!
John Hess
0 Kudos
Message 1 of 8
(2,876 Views)

Hi Ethan,

 


@EthanTheHut wrote:

What file extension do I use when using the write waveforms to file vi?


You can use any file extension you like…

But keep in mind: choosing an arbitrary file extension does not change the data formatting used by the WriteWaveformToFile function. This function creates datalog files…

When you want something more "usual" you should consider using ExportWaveformsToSpreadsheetFile instead!

Best regards,
GerdW


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

But when it prompts in ether case, what file extension do I use?

Thanks!
John Hess
0 Kudos
Message 3 of 8
(2,869 Views)

If using the Export Waveforms To Spreadsheet, I would use a txt extension.



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 4 of 8
(2,864 Views)

As the help says: "You can use any file extension, for example .dat or .txt, for the file you write the waveform data to."

 

Be aware that a file extension does not define any specific formatting of the content. it only gives the OS a hint what app to use to open it when you double-click it. (e.g. notepad for *.txt by default). It does not mean that that works in all cases.

 

Your problem will be to correctly read it in Matlab. As Gerd already said, this will be in datalog format, and you would need to understand the structure and how to read it, unless somebody already wrote a matlab tool for that.

 

I recommend to write simple tab delimited data, e.g. two columns (time and value), where the time column is constructed from t0 and dt of the waveform.

 

Of course if your matlab program is just some simple analysis, consider rewriting it in LabVIEW directly. No need for matlab. 😄

0 Kudos
Message 5 of 8
(2,858 Views)

is there a way to get a .mat file from a waveform?

Thanks!
John Hess
0 Kudos
Message 6 of 8
(2,856 Views)
Solution
Accepted by topic author EthanTheHut

@EthanTheHut wrote:

is there a way to get a .mat file from a waveform?


Yes. LabVIEW is a full featured programming language and you can define to the last bit what you want in the file. All you need to know is the structure of the *.mat file.. 😄

 

(It is possible that somebody already wrote such a converter, so search this forum and the internet. (example))

0 Kudos
Message 7 of 8
(2,849 Views)
Solution
Accepted by topic author EthanTheHut

In a post I could not find, someone asked if it solved my problem. 

 

What I wanted to do was to get a .mat file from a waveform out of LabVIEW. The engineers wanted a .mat as they often do and as a test engineer I have to give them the format they want. All of us know that you can do most of what they want, if not all of what they want in LabVIEW. 

 

The simple solution is that MATLAB has a plugin (if thats what its called) that can be used with the LabVIEW Storage/DataPlugin functions in the file IO section of the functions palet. 

 

As someone said below, you just need to know the structure of the .mat file the engineers or you want. The output structure is configurable depending on how you set up channel groups with channels contained within each group. 

 

I attached an example of how I did this with a Oscope Driver from Keysight to get and insert the desired waveform. If you dont have a 100K oscope to work with, just use a simulated waveform under waveforms palet. 

 

Thanks to everyone who helped me find this solution! 

 

EthanTheHut_0-1635951456301.png

 

 

Thanks!
John Hess
0 Kudos
Message 8 of 8
(2,766 Views)