10-26-2021 11:36 AM
What file extension do I use when using the write waveforms to file vi?
I ultimately want to use the file in MATLAB
Solved! Go to Solution.
10-26-2021 11:43 AM
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!
10-26-2021 11:47 AM
But when it prompts in ether case, what file extension do I use?
10-26-2021 12:01 PM
If using the Export Waveforms To Spreadsheet, I would use a txt extension.
10-26-2021 12:06 PM
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. 😄
10-26-2021 12:06 PM
is there a way to get a .mat file from a waveform?
10-26-2021 12:09 PM - edited 10-26-2021 12:10 PM
@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))
11-03-2021 09:58 AM
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!