LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab script in Labview

Hi there,
I want to integrate my Matlab script in Labview,
the input variable should be a Matrix like
the following A = [ 0 256 ; 1 256 ;1.5 100 ; 1.55 110; 1.59 55; 1.6 56 ; 9 256; 14 256 ;15 100 ]
How do I do this in Labview, I tried an array but
no succes...
Bye for now
0 Kudos
Message 1 of 24
(4,603 Views)
Hi,

In LabVIEW, you'll need to create a 2D array of double, and feed that array into an input of the MatLAB Script (remember to right click on the input and select "real matrix" as the input data type.
0 Kudos
Message 2 of 24
(4,603 Views)
Again, the trick is to right click.....

Tx
0 Kudos
Message 3 of 24
(4,604 Views)
hi ... im trying to use matlab codes in labview... but i can't get the input data type right

i've attached my codes.. could anyone teach me how to change the data types....

do i need anything to run ,matlab codes ?? i heard about something called activeX .. could anyone please hepl me ?? thanx
0 Kudos
Message 4 of 24
(4,459 Views)
Hi Kupikupi,

Your array needs to be a 2-D array of doubles.  The easiest way to select this is to right-click on the input node labeled 'A', and select Choose Datatype » 2-D Array of Real.
Then you can wire up a 2-D array of doubles to the input.  Repeat for the 'B' input.  To easily create a constant of type 2-D array of doubles, you can right-click on the input terminal of the 'A' input node and select Create » Constant.

To use the MATLAB Script node you need a licensed version of MATLAB on your machine.

With LabVIEW 8.2 you can also use the MathScript window which allows you to run many m-file sytax scripts.
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 5 of 24
(4,437 Views)
hi ...

i just found out that labview 7.1 does not support matlab toolbox...

im not so familiar with matlab and i have codes using the toolbox.. is there any thing i can do about that?

i've attached my matlab codes.. please help me

thanks
0 Kudos
Message 6 of 24
(4,418 Views)
Hi kupikupi,

I'm not sure what you mean by "labview 7.1 does not support matlab toolbox..." I don't know what you are asking either.  Unfortunately I'm not a MATLAB expert so I can't help in the area of syntax.


Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 7 of 24
(4,408 Views)
Hey Kupikupi,

When you use LabVIEW to run MATLAB through M-script nodes, you need to have MATLAB and any toolboxes you want to use installed on your machine. What is really happening is LabVIEW is opening MATLAB up behind the scenes (using ActiveX, which is included in Windows) and sending your script to it. LabVIEW doesn't really care about the MATLAB toolboxes. If your script works in MATLAB, it should work from a M-script node in LabVIEW.

If you could provide a little more information, it may help debug your program. Can you run "ver" in MATLAB and post the results so we can see what toolboxes you have installed? Also, I'd suggest running your script in short bits to help identify where the bug is.

Chris
0 Kudos
Message 8 of 24
(4,405 Views)
hi chris .. thanks for the reply ...


here's the results from 'ver

-------------------------------------------------------------------------------------
MATLAB Version 7.0.1.24704 (R14) Service Pack 1
MATLAB License Number: 227039
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 2)
Java VM Version: Java 1.4.2_04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM
-------------------------------------------------------------------------------------
MATLAB                                                Version 7.0.1      (R14SP1)
Simulink                                              Version 6.1        (R14SP1)
Aerospace Blockset                                    Version 1.6.1      (R14SP1)
Bioinformatics Toolbox                                Version 1.1.1      (R14SP1)
CDMA Reference Blockset                               Version 1.1        (R14SP1)
Communications Blockset                               Version 3.0.1      (R14SP1)
Communications Toolbox                                Version 3.0.1      (R14SP1)
Control System Toolbox                                Version 6.1        (R14SP1)
Curve Fitting Toolbox                                 Version 1.1.2      (R14SP1)
Data Acquisition Toolbox                              Version 2.5.1      (R14SP1)
Database Toolbox                                      Version 3.0.1      (R14SP1)
Datafeed Toolbox                                      Version 1.6        (R14SP1)
Embedded Target for Infineon C166 Microcontrollers    Version 1.1.1      (R14SP1)
Embedded Target for Motorola HC12                     Version 1.1.1      (R14SP1)
Embedded Target for Motorola MPC555                   Version 2.0.1      (R14SP1)
Embedded Target for OSEK VDX                          Version 1.1.1      (R14SP1)
Embedded Target for TI C2000 DSP(tm)                  Version 1.1.1      (R14SP1)
Embedded Target for TI C6000 DSP(tm)                  Version 2.2.1      (R14SP1)
Excel Link                                            Version 2.2.1      (R14SP1)
Extended Symbolic Math                                Version 3.1.1      (R14SP1)
Filter Design HDL Coder                               Version 1.1        (R14SP1)
Filter Design Toolbox                                 Version 3.1        (R14SP1)
Financial Derivatives Toolbox                         Version 3.0.1      (R14SP1)
Financial Time Series Toolbox                         Version 2.1.1      (R14SP1)
Financial Toolbox                                     Version 2.4.2      (R14SP1)
Fixed-Income Toolbox                                  Version 1.1        (R14SP1)
Fixed-Point Toolbox                                   Version 1.1        (R14SP1)
Fuzzy Logic Toolbox                                   Version 2.2        (R14SP1)

0 Kudos
Message 9 of 24
(4,404 Views)

RF Toolbox                                            Version 1.0.1      (R14SP1)
Real-Time Windows Target                              Version 2.5.1      (R14SP1)
Real-Time Workshop                                    Version 6.1        (R14SP1)
Real-Time Workshop Embedded Coder                     Version 4.1        (R14SP1)
Robust Control Toolbox                                Version 3.0        (R14SP1)
Signal Processing Blockset                            Version 6.0.1      (R14SP1)
Signal Processing Toolbox                             Version 6.2.1      (R14SP1)
SimDriveline                                          Version 1.0.1      (R14SP1)
SimMechanics                                          Version 2.2.1      (R14SP1)
SimPowerSystems                                       Version 4.0        (R14SP1)
Simulink Accelerator                                  Version 6.0.1      (R14SP1)
Simulink Control Design                               Version 1.1        (R14SP1)
Simulink Fixed Point                                  Version 5.0.1      (R14SP1)
Simulink Parameter Estimation                         Version 1.1        (R14SP1)
Simulink Report Generator                             Version 2.1.1      (R14SP1)
Simulink Response Optimization                        Version 2.1        (R14SP1)
Simulink Verification and Validation                  Version 1.0.1      (R14SP1)
Spline Toolbox                                        Version 3.2.1      (R14SP1)
Stateflow                                             Version 6.1        (R14SP1)
Stateflow Coder                                       Version 6.1        (R14SP1)
Statistics Toolbox                                    Version 5.0.1      (R14SP1)
Symbolic Math Toolbox                                 Version 3.1.1      (R14SP1)
System Identification Toolbox                         Version 6.1        (R14SP1)
Video and Image Processing Blockset                   Version 1.0.1      (R14SP1)
Virtual Reality Toolbox                               Version 4.0.1      (R14SP1)
Wavelet Toolbox                                       Version 3.0.1      (R14SP1)
xPC Target                                            Version 2.6.1      (R14SP1)
xPC Target Embedded Option                            Version 2.6.1      (R14SP1)'


this is all i have...
btw.. i have modifed my matlab codes to let it run without calling function .. it gives the correct result ...
but i just can't run it in labview... i was thinking maybe it is the data type problem .. i keep changing but nothing is workng for me .. im not so familiar with matlab .. i hope u can help me .. thanks

0 Kudos
Message 10 of 24
(4,393 Views)