LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Matlab script in Labview

That's great! I would check the output of "ver" in matlab for both of those computers to make sure the same toolkits are installed. You'd have to do the same debugging strategy (break the program down...) to determine exactly what function is choking on one computer and not the other. If the whole m-script node isn't working, than it's a bigger problem. It could just be that computer?

Anyway, I'm glad your program is running. Good luck with future MATLAB and LabVIEW work.

Chris
0 Kudos
Message 21 of 24
(969 Views)
Hi:
I have a problem in the matlab script node, i did a program in matlab that implemented and simulated an MPC controller, but i want to use this program in labview matlab script node because i want to implement with real hardware, sensors and actuadors, but when i try to assign the inputs and outputs in this node appears an error (1047  and 1048).
Please if somebody help me
thanks
 
this is my program:

12 = 0;

g13 = 0;

g21 = tf( 0.027, [1 0],

'IOdelay', 0.3);

g22 = tf(-0.021, [1 0],

'IOdelay', 0.6);

g23 = 0;

g31 = 0;

g32 = tf(0.075, [15.3 1],

'IOdelay', 15);

g33 = tf(-0.095, [25 1],

'IOdelay', 11);

DC = [g11 g12 g13

g21 g22 g23

g31 g32 g33];

DC.InputName = {

'valvulacaudal', 'valvulanivel', 'ventilador'};

DC.OutputName = {

'caudal', 'nivel', 'temperatura'};

DC = setmpcsignals(DC);

DC;

Ts = 1;

%

clear

MV OV

MV(1)=struct(

'Min',0,'Max',100);

vc=MV(1);

MV(2)=struct(

'Min',0,'Max',100);

vn=MV(2);

MV(3)=struct(

'Min',0,'Max',100);

v=MV(3);

OV(1)=struct(

'Min',-Inf,'Max',Inf);

c=OV(1);

OV(2)=struct(

'Min',-Inf,'Max',Inf);

n=OV(2);

OV(3)=struct(

'Min',-Inf,'Max',Inf);

t=OV(3);

Weights=struct(

'Input',[0 0 0],'InputRate',[0 0 0],'Output',[10 10 10]);

P=115;

% Prediction horizon

moves=1;

% Control horizon

MPCobj = mpc(DC,Ts,P,moves,Weights,MV,OV);

MPCobj.Weights=Weights;

MPCobj.MV=MV;

MPCobj.OV=OV;

T = 300;

r = [30 30 -10];

sim( MPCobj, T, r);

0 Kudos
Message 22 of 24
(717 Views)
I can't tell from this code, but are you trying to return some parameter of the object or struct?  It is important to remember that MATLAB script nodes can only return values of type double or string (or some array thereof).

If your structs and objects use integer data types, you'll have to store the data in a variable of type double before you can return them to LabVIEW.
0 Kudos
Message 23 of 24
(708 Views)
thans
 
0 Kudos
Message 24 of 24
(662 Views)