Real Time Plotting in Gui by taking data from Simulink

Hi,
I have a real time simulation and i want to make a real time plot in gui. When i take the data from simulink it gives me a finished plot while my simulation is still i running. I want to generate my plot when the action is happening not before. Is there a way to do so?

답변 (1개)

Jon
Jon 2020년 9월 16일

0 개 추천

One way to do this is using get_param to get data from run time objects

댓글 수: 2

First start your simulation running, blocks don't have run time objects until simulation is running
Get the run time objects for the desired blocks using something like:
rto = get_param('myBlockName','RunTimeObject')
note if you don't know the block's name (here I just called it 'myBlockName', you can select the block in the diagram, and then on the command line issue the command
gcb
which will display the block name.
Once you have the run time object assigned to the variable rto, you can get data out of it at any time while the simulation is running using
val = rto.InputPort(1).Data
val = rto.OutputPort(1).Data
to get the instantaneous value of the block input and the output respectively
I suppose it is fastest real-time plot. Has Simulink linking example.
Well documented. World-wide known.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2020년 9월 16일

댓글:

2020년 11월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by