From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating .mat files with Matlab dataplugin in LabVIEW

Solved!
Go to solution

I am trying to create a .mat file in LabVIEW using the Matlab dataplugin. It appears to create a group called "Vector" without being told to, and it also concatenates group and channel names together. I have made an example to demonstrate this behaviour. I am trying to create a group called "Group" and inside it a channel called "Channel". What I get looks like a group called "Vector" and inside it a channel called "GroupChannel". What am I doing wrong?

 

Best Regards,

John Sackett

0 Kudos
Message 1 of 9
(10,747 Views)

Hello John

 

Thank you for getting in touch regarding your issue. I am an applications engineer here at National Instruments, as I understand you are using the data plugin for Matlab within LabVIEW, but as shown with your code when you label the channel or group you get an outcome which you don't expect.

I have opened and had a look at your code and can see where the issue is arising. The functions you are using are normally used with TDM files, .MAT files are compatible but there are a few differences between the file formats, which is why you are getting the outcome we have seen. A TDM file has headers named channelgroup and channel, but Matlab does not have the channelgroup header in the file type and therefore the functions in LabVIEW merge the 2 strings to the available header.

 

I am not able to open your .MAT file so could you give me a brief description of what occurs inside Matlab?

Have you looked into using the script node to allow for .MAT file types in LabVIEW? Here is the help file

 

I have also found some resources which you may find useful.

LabVIEW to MATLAB

Convert file

Open .MAT in LAbVIEW

DataPlugin

 

Let me know if you would like any further information

 

Regards

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 2 of 9
(10,722 Views)
Solution
Accepted by topic author johnsackett

Dear Stephanie,

 

Thanks for your reply. It looks like I cannot use the Matlab dataplugin, because it is trying to force the .mat file to be like a .tdm file. I found your list of resources very helpful and am using the information in "LabVIEW to MATLAB" to make my own .mat file writing vi's.

 

Best Regards,

John Sackett

0 Kudos
Message 3 of 9
(10,687 Views)

Hi,

 

I too face the same issue. I have a .mat file in which I have to edit a column and save it to the same mat file. I could edit the mat file using storage VIs, my input file has two groups in it, but my modified file has only one group and with default name Vector. Could you please help me in this regard?

 

Pls find the attachment for details.

 

Thanks..

 

0 Kudos
Message 4 of 9
(10,616 Views)

Dear techy123,

 

The thing called "Vector" that the Matlab dataplugin shows you is very confusing. It appears even if it does not exist in the matlab file. This is because the dataplugin always tries to make the matlab file look like a TDM file. I had to abandon trying to use the dataplugin and write my own code to directly read and write the Matlab files.

0 Kudos
Message 5 of 9
(10,605 Views)

Hi johnsackett,

 

Thank you for the reply. I would like to know is there any other way I could accomplish this. Or is there a tool which can convert .TDM format to .Mat format?

 

Thanks. 

0 Kudos
Message 6 of 9
(10,597 Views)
Dear techy123,
 
Following a reply from Stephanie L (see above), I used the information in LabVIEW to MATLAB to write my own .mat file access routines at the lowest level. In there is a reference document for the .mat format and a whole set of vis to create .mat files. I wanted to do something simpler and slightly different, so I wrote my own code, but it was very useful to look at this code to see how it can be done.
 
Best Regards,
John Sackett
0 Kudos
Message 7 of 9
(10,584 Views)

I am also having the same problem, I was wondering did you find a solution to convert .TDMS to .mat in labview?

 

0 Kudos
Message 8 of 9
(9,733 Views)