Home > Net >  Matlab script: Display the outputs of my Simulink model
Matlab script: Display the outputs of my Simulink model

Time:11-04

I have the following Simulink model: enter image description here

I have the following script:

Constant=43;
Constant1=43;
Constant2=43;
Constant3=43;
Constant4=43;
Constant5=43;
Constant6=43;
Constant7=43;
Constant10=43;
Constant11=43;
In1=[1,2,3];
In2=[4,5,6];
t_stop = 10;
T_s = t_stop/1000;
options = simset('solver', 'ode5', 'fixedstep', T_s);
sim('test_lau.slx',t_stop,options)

I want to display and eventually call the outputs Display, Display2 and Display3.

I tried changing the last line to:

[Display, Display2, Display3]=sim('test_lau.slx',t_stop,options)

But get the error:

Number of left-hand side arguments doesn't match block diagram. When specifying that root-level outports are to be returned individually, the number of left-hand side arguments must be 2 (for T,X) plus number of root-level outport blocks

Does anyone know how to extract those outputs from a script?

Thank you in advance for your help!

CodePudding user response:

Thanks to @Ander Biguri and @Wolfie The answer was using the block "to Worskpace" instead of the block "Display"

  • Related