Access block output data from simulink in python
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call MATLAB from Python 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!