Access block output data from simulink in python
2 views (last 30 days)
Show older comments
Hi All,
I am trying to run a simulink model form python using matlab engine. I am able to load the model and data in the workspace and run the simulation. I would like to read the outputs of a subsytem block from the simulink model during simulation that I can then use in python.
I tried using the add_exec_event_listener function in the startFcn callback of the subsystem
blk = 'path/to/the/subsystem'
add_exec_event_listener(blk,'PostOutputs',@readsubsysdata)
where readsubsysdata.m is
function [data1] = readsubsysdata(block,~)
data1 = block.outport(1).data;
end
How do I read the data from the block in python during the simulation? I am not sure if I completely follow the steps of doing so.
Thanks in advance!
0 Comments
Answers (0)
See Also
Categories
Find more on Call MATLAB from Python in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!