LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MATLAB SIMOUT AND LABVIEW

Hello
 
Is there any method in labview to import the matlab values generated in "simout" (one column and "n" rows) and store them in an array of labview for processing in labview.how is it possible from matlab or labview point of view.
 
 
Regards
Madd
0 Kudos
Message 1 of 13
(10,166 Views)
Hi
 
There are several ways you can try.
1. Use Matlab Script Node in LabVIEW and make the value as output of the node.
2. Save the value, in array format, in Matlab environment and load the .mat file in MathScript. Note that you must specify -v6 option for save command.
3. Use the DataPlugins that NI provides. For more information, please visit http://zone.ni.com/devzone/cda/epd/p/id/4178.
 
0 Kudos
Message 2 of 13
(10,116 Views)
Tnx
 
For ur reply but the link u have mensioned above having matlab_.zip file on it is not working when i extract it .It says "the archive is either in unKnown format or damaged". will u plz check this out.
 
Regards
Madd
0 Kudos
Message 3 of 13
(10,099 Views)
Hi,
 
I tried and it worked well on my machine.
 
0 Kudos
Message 4 of 13
(10,096 Views)

Heloo

1.  ok i have tried 2nd method . i have saved the data in matlab i have run the command on matlab it is working perfectly  but in Labview there is an indiacation in mathscript node (a yellow triangle) as i paste the same command in labview and when i run error (which say's the file u specified is either moved or deleted or check the path bala bala bala). i have also pasted it in Matlab Script it runs ok but as i put an indicator(1D real array) at output i gives me an error (which is same as i have mentioned earlier).Another important question what  should be the output of mathscript i think it should be "simout12".(see attachment)

2. i have downloaded matlabzip_ several times does it size about(1.60Mb) if so i have down loaded it again but no result .Can u send me an attachment of this as my reply (but without any zip). might be there is a problem with my zip.

Regards

Madd

0 Kudos
Message 5 of 13
(10,093 Views)
Hi,
 
The warning glyph indicates that LabVIEW operates with reduced error checking and slower run-time performance for the MathScript Node. There are serveral functions that lead to this behavior. load is one of them, since load introduce new variables at run-time. You may find more detail about this in LabVIEW Help, MathScript Node.
 
For the script you use, the syntax is not correct, although it works in Matlab. In MathScript, you should use the following syntax
  load file a, b, ..., c
For example, you may use the following script to load your .mat file.
  load 'C:\Documents and Settings\Administrator\Desktop\matlab.mat' simout12
 
I double check the zip file, using another machine, and do not see the problem. It looks like your zip does not work correctly.
 
If you have any problem, please feel free to let me know. You may also attach the .mat file. Then, I can have a try.
 
Regards
Bin Wang
0 Kudos
Message 6 of 13
(10,090 Views)
Hello,

Unfortunately, the LabVIEW help for "save" and "load" is incorrect.  The proper syntax is as follows (note: no commas between variables):
load file a b ... c
In MathScript, the first argument to the load command is the filename to use.  You do not need to specify the "-mat" option.  Try one of the following instead:
load 'C:\Documents and Settings\Administrator\Desktop\matlab.mat' simout12
or
load('C:\Documents and Settings\Administrator\Desktop\matlab.mat', 'simout12')
Then your data will be loaded in the simout12 variable.  If you wish to bring this into LabVIEW, create an output variable called simout12.  Set it to be the appropriate data type by right-clicking and selecting "Choose Data Type."

Also, I have tried the zip file with both WinZip and 7-zip.  I do not see any problems in extracting the file.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 7 of 13
(10,075 Views)
Hello
 
new problem. command is working . but when i want to see the array of my simout12 it shows an error(see attachment). while doning simulation on matlab i have set the properties of my simout to array not structure. so i think when i create simout12 as output of  mathscript by setting 1D array Real. i should give me the array of simout12. But labview says it (simout12) in not a name of valid function, variable.will u PLZ check this one out.
 
Regards
Madd
0 Kudos
Message 8 of 13
(10,039 Views)
Hello,

This error means the "simout12" variable was not defined by your script.  What likely happened is that the data in your file is not in a format that MathScript can understand.  Is it possible that the simulation array output you speak of is actually a "cell array"?  MathScript does not currently understand those.  If not, can you post the data file so we can investigate the problem?

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 9 of 13
(10,026 Views)

Hi Madd,

Is it possible for you to attach the .mat file such that I can know what's going on?

Regards

Bin Wang

0 Kudos
Message 10 of 13
(10,018 Views)