LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

MAT file I/O

Solved!
Go to solution

OK so first things first (to answer what will likely be the first 4 responses... Smiley Happy )

 

1.  Yes, I have looked at the DataPlugin. Unfortunately, I need much more capability than it supports.

2.  Yes, I have looked at the matio library.  It is a great start, but it is still incomplete and a little buggy.

3.  No, I can't use the script node because the deployment PC won't have a matlab license.

4.  Yes, I did see the EvaluMation toolkit on VIPM.  I played with the trial and it seems much more complete and not buggy.  Unfortunately, they were bought by AEgis, and I can no longer find a way to purchase a license.

 

Anyway, so yea.  Does anyone have or know of a complete .mat file I/O toolkit?  If not, it looks like I'll be going through the matfile format and debugging the parts of the matio library that I need to use.  But that is tedious and I don't wanna Smiley Indifferent

0 Kudos
Message 1 of 7
(6,017 Views)

I do not have a complete Mat file I/O, I have only written stuff to convert TDMS to Mat files, no need to read them.

 

  1. The matio library is a nice start, but, you need to modify it to make it less memory intensive. Attached are VIs to write a simple 1D array as a variable. These VIs are based on the matio project.
  2. The matio library is based on an older version of Matlab files. Newer versions use HDF file format. There is a matlab example in the Hierarchical Data Format (HDF5) v2.13.1.143 by Martijn Jasperse, from VIPM, look in the examples folder for it.

Number 2 is your best bet for future compatibility as the old format, the matio library, is not being used as much.

 

mcduff

 

 

EDIT: Forgot to include a subVI. Now attached separately.

Download All
Message 2 of 7
(5,986 Views)

@mcduff wrote:

 

Number 2 is your best bet for future compatibility as the old format, the matio library, is not being used as much.

 


Thanks for your response.  I've done some research on the HDF5 file format after your post... and I can't find anything really that supports this claim. Yes, MATLAB does support HDF5 files, but I can't find anything that says it's replacing the .MAT format by default.

 

I'm not contradicting you by the way - I'm just curious as to why you make the above claim.  If I switch my plans from using .MAT to HDF5, I'd like to know why 🙂

0 Kudos
Message 3 of 7
(5,951 Views)

The new version of the Mat file is based on HDF, See http://www.mathworks.com/help/matlab/import_export/mat-file-versions.html?requestedDomain=www.mathwo...

 

Look at the note "Version 7.3 MAT-files use an HDF5 based format"

 

You will see other limitations of the old version also, 2^31 bytes per variable, among others.

 

Note the example I sent only works for 1d arrays of doubles, you can as many arrays as you want, with aforementioned conditions.

 

mcduff

0 Kudos
Message 4 of 7
(5,944 Views)

@mcduff wrote:

 

Look at the note "Version 7.3 MAT-files use an HDF5 based format"

 


So does this mean it is a modified HDF5 format, or is it actually HDF5 but with a .mat extension?

 

Worded another way, could I use the C++ HDF API to read a .mat file flawlessly?

0 Kudos
Message 5 of 7
(5,938 Views)
Solution
Accepted by topic author BowenM

I have used HDFView to open a mat 7.3 file, so an HDF file with a MAT extension and a Matlab specific header.

 

See the example I referenced earlier, use VIPM to get the HDF library. I won't attach it becasue you need the HDF library I referenced earlier but below is a snippet and documentation.

 

"Version 7.3 of the file format uses HDF5 internally, so h5labview can be used to
read MAT files to load data from MATLAB directly into LabVIEW. This example
demonstrates how to use h5labview to build a MAT file for loading into MATLAB."

 

Snip1.png

 

snip2.png

 

mcduff

 

 

 

 

Message 6 of 7
(5,928 Views)

Great!  I figured that was the case, but I wanted to validate since I am new to the HDF file format.

 

Thanks for all of your help.

0 Kudos
Message 7 of 7
(5,923 Views)