LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read mat file in labview?

Solved!
Go to solution

how to read and plot mat file in labview ?

0 Kudos
Message 1 of 13
(3,687 Views)
Solution
Accepted by topic author amandeepkaur

Hi amandeepkaur,

 


@amandeepkaur wrote:

how to read and plot mat file in labview ?


You could use ReadBinaryFile and parse the mat file on your own.

You could also try to use DataPlugins for Matlab files…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 13
(3,684 Views)

You have to know the data that is in the mat file in order to parse it.  But once you do, you can use Read Binary File to get the data.  But Matlab, by default, will write the data in a Little Endian format while LabVIEW defaults to a Big Endian.  So you need to use the Byte Order input on the Read Binary File to tell LabVIEW to use Little Endian.


GCentral
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 3 of 13
(3,630 Views)

how are we gonna know the data before reading it?

0 Kudos
Message 4 of 13
(3,627 Views)

Hi amandeepkaur,

 


@amandeepkaur wrote:

how are we gonna know the data before reading it?


Ask the person who created those Matlab files - or read the Matlab code which was used to create the files…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(3,624 Views)

can you illustrate your answer with VI?

0 Kudos
Message 6 of 13
(3,623 Views)

Hi amandeepkaur,

 


@amandeepkaur wrote:

can you illustrate your answer with VI?


In case you are talking about my message regarding dataplugins: using the link above you will also find examples/explanations on how to use them in LabVIEW!

 

(Hint: Sometimes it helps to name the person you are answering to!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 13
(3,618 Views)

@amandeepkaur wrote:

can you illustrate your answer with VI?


Well, this code assumes the mat file is just 3 double precision floating point values repeated (X Y Z X Y Z X Y Z etc).  Again, you need to know the format of the data in the mat file.


GCentral
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 8 of 13
(3,608 Views)

I was trying to load mat file in labview.

I used data plugin open data storage to load mat file and then read data to read the mat file.

How can I plot the data, I was unable plot the data using waveform graph. The wire b/w dataplugin read file and waveform graph couldn't connect. The error appears to be of different datatypes of both terminal i.e. waveform graph and dataplugin read file. What would be the possible solutions to make the data type of same type?

 

How to access the contents of mat file to use for further operation like multiplication, etc after the reading operation?

 

0 Kudos
Message 9 of 13
(3,526 Views)

Hi amandeepkaur,

 


@amandeepkaur wrote:

How can I plot the data, I was unable plot the data using waveform graph. The wire b/w dataplugin read file and waveform graph couldn't connect. The error appears to be of different datatypes of both terminal i.e. waveform graph and dataplugin read file. What would be the possible solutions to make the data type of same type?


So there is a problem in YOUR CODE, but you only wrote some short sentences describing the problem with very generic words.

Maybe it would make sense to attach YOUR CODE so we can determine the problem and help you to remove it?

(Btw. attaching images of code is usually considered the same as attaching no code…)

 

The other possible solution would be to debug YOUR CODE by YOU…

 


@amandeepkaur wrote:

How to access the contents of mat file to use for further operation like multiplication, etc after the reading operation?


You access the content by reading the data into wires of the correct datatype…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(3,518 Views)