Is it possible to read the value of a Simulink signal passing through a signal line from the MATLAB command line?

39 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Nov 2016
This feature has been added in Simulink 6.0 (R14). See the following section of the Simulink documentation:
Accessing Block Data During Simulation :: Working with Blocks (Using Simulink):
For example, to access the output data from a particular block during simulation, perform the following steps:
1) Set the simulation stop time to 'Inf'
2) Start the simulation
3) Click on the block you want to access
4) Type the following at the MATLAB Command Line:
rto = get_param(gcb,'RunTimeObject');
get(rto.OutputPort(1));
If you are using a previous version, see the following:
The ability to do read the value of a signal from the MATLAB command line during a simulation is not available in Simulink.
To work around this issue, you can write a MATLAB file S-Function to send data to the MATLAB workspace during the simulation. For more information, see the following Related Solution "How do I log a signal from my Simulink model to the MATLAB workspace at each simulation time step?"

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!