LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW save scope data into .mat file

Hi,

 

I was trying to create a LabVIEW program that will grab waveform data from Tektronix MSO64 and save it into .mat file for data processing in MATLAB.

 

So far I managed to save the scope data into csv file (as shown in the image below). 

CK98_0-1707902107801.png

 

However, I was just wondering if there's a way to save the 2D array into .mat file in LabVIEW so I can directly process the data in MATLAB, without having to do csv to mat conversion in MATLAB?

 

Thanks.

 

0 Kudos
Message 1 of 5
(450 Views)

Look on VIPM. There are two libraries for H5; theu can be used to create Matlab files. (.mat is basically a H5 file)

0 Kudos
Message 2 of 5
(407 Views)

You can use MATLAB DataPlugin with LV's Data Storage Express VIs.

 

santo_13_0-1707924870336.png

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 5
(395 Views)

@santo_13 wrote:

You can use MATLAB DataPlugin with LV's Data Storage Express VIs.

Versions of this Plugin exist (only) for LabVIEW 2019 and LabVIEW 2021, and appear to require at least the Full (which means that Professional and Academic licenses should also work). 

 

Bob Schor

0 Kudos
Message 4 of 5
(382 Views)

I have installed the plugin and attempted to create a .mat file using the storage VI. However, I was getting some strange data when I open the file in Matlab. The Signal input on Write Data VI only accept unsigned byte array so maybe I was doing something wrong in the data conversion. I have seen other forum post saying that it's tricky to use Matlab dataplugin, because it is trying to force the .mat file to be like a .tdm file. (https://forums.ni.com/t5/LabVIEW/Creating-mat-files-with-Matlab-dataplugin-in-LabVIEW/td-p/1678970)

 

Also, I have found an example code from this forum post (https://forums.ni.com/t5/Example-Code/Convert-File-to-MAT/ta-p/3492051) to convert files into .mat. I have tried the code and it does the job! But so far I only managed to save a 2D array and I'm still looking if it's possible to save multiple 2D array as struct in Labview.

 

FYI, MSO64 save data storageVI.vi is the one I tried to use Matlab dataplugin and the con2mat is the one with example code.

0 Kudos
Message 5 of 5
(353 Views)