LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving variables in mat file via Matlab script

Hello,

As you can see in the attached file, I have a problem with saving a cluster in 
a Matlab file. I am using a Matlab script bloc.

I have a cluster with all the channels settings: Vmax, Vmin, Channels names, 
Physical channels names,...

In my programm, I would like to transfer the cluster variable in a Matlab script 
to save it in a mat file. This is the best way I find to create a mat file.

I tried to do it. The Vmax, Vmin worked, but I am having troubles with the 
other variables.

Can you help me transfer the cluster in a Matlab Script. Maybe I am not doing 
the right thing,

NB: the cluster size changes according to what the user choose as number of channels 
inputs, their names, physical names,....

Thank you,

Hakim

0 Kudos
Message 1 of 6
(2,767 Views)

Hi Hakim,

Have you taken a look at this document?

Working Between the MathWorks, Inc. MATLAB® Software Development Environment and LabVIEW

Be sure to update us on your progress.  Have a good day!

DillonL.
0 Kudos
Message 2 of 6
(2,724 Views)

Hi Dillon,

 

Yes I did.

 

As you can see in the doc file, my problem is to transfert certtain type of variables to the Matlab Script Node.

This is the way I figure out to save my data into a mat file withou using an external library or any other programs that are not developped by NI.

 

Thank you,

 

Hakim

0 Kudos
Message 3 of 6
(2,719 Views)

Hakim,

Can you give me some more information on the errors you are seeing when you try to pass the other data types?  Is there a standard error message that occurs or is it just unexpected data or will it not work at all?  

DillonL.
0 Kudos
Message 4 of 6
(2,703 Views)

Hi Dillon,

 

When you add an input (MATLAB script bloc) for the Measurement Name variable for example, you have a broken wire because the input-output variable are not of the same type. But when you click on choose data type, you do not have a choice for an array of string for example.

The same thing for DAQmx Physical Channel, I did not find which type of data can match with it to connect it to the MATLAB script bloc.

 

Thank you,

 

Hakim

0 Kudos
Message 5 of 6
(2,697 Views)

Hi Hakim,

The node only supports certain data types.  In order to use data types other than the supported ones, you will have to convert them into ones that are supported.  Below are the supported types:

Comparison of MathScript RT Module and the MATLAB® Software Data Types in LabVIEW

DillonL.
0 Kudos
Message 6 of 6
(2,676 Views)