LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Matlab data file

Hello,

 

I am trying to open a matlab data file created by a third party data logger software, the file extension is *.mat.  I plan to use Labview to read the arrays of data and to do further analysis.

 

Please can you advise on the approach and what functions are required.

 

Thanks in advance.

 

 

Duc

0 Kudos
Message 1 of 12
(4,587 Views)

.mat file are prorietary and it is not recommended to write your own interface, because the structure could change in the future.

 

Quote from the matlab help:

"The MAT-file interface library contains routines for reading and writing MAT-files. You can call these routines from your own C and Fortran programs. Use these routines, rather than attempt to write your own code, to perform these operations, since using the library insulates your applications from future changes to the MAT-file structure."

 

What is your LabVIEW version? Do you also have matlab installed?

Message 2 of 12
(4,580 Views)

Hi Duc,

it should be possible with the "MathScript Node". According to the LabVIEW help you can use the "load" function to load your data from the *.mat file.

 

Hope it helps.

Mike 

Message 3 of 12
(4,579 Views)

Hi,

 

The problem is that I don't have Matlab so I assume I can't use the Mathscript Node function?  I am using Labview 8.5

 

Duc

0 Kudos
Message 4 of 12
(4,521 Views)

Hi Duc,

did you try it? I thought you can use the MathScript node without MATLab. I can´t try because i have no mat file. Smiley Happy

 

Mike 

Message 5 of 12
(4,519 Views)

Hello Mike,

 

I have attached the type of mat file I am trying to read.  I think it may be in binary format.  

 

Are you able to read it using the Script node? 

 

According the to link below, it talks of a Vi to parse the file. 

 

"Binary Format
Complete the following steps if you want to import or export data between LabVIEW and MATLAB®.
From the MATLAB® environment to LabVIEW

  1. To read a .mat file in LabVIEW would require a VI to parse the file. This may be easier if each variable is saved to a separate file.  "

 

Are there any further details on that section?  Its quite brief.

 

http://digital.ni.com/public.nsf/websearch/2F8ED0F588E06BE1862565A90066E9BA?OpenDocument

 

 

Thanks,

 

Duc

0 Kudos
Message 6 of 12
(4,513 Views)

Hi Duc,

do you know the name and type of your variables in your file? See also this link.

Mike 

Message 7 of 12
(4,509 Views)

Hi Mike,

 

Varible name is "data", I am not too sure of the type.

 

Duc

0 Kudos
Message 8 of 12
(4,507 Views)

Hi duc,

you can use the MathScript node. I can read the file, but i can´t see some data. Maybe you can see more. You can also use a probe on the MathScript node to see what was loaded.

Mike 

Message 9 of 12
(4,501 Views)

Thanks Mike!

 

Please can you kindly make a print screen of your diagram or attach the Vi, so I can copy it without any problems.  This would save me such much time.

 

Thanks in advance,

 

Duc

 

 

0 Kudos
Message 10 of 12
(4,481 Views)