Real Time Plotting in Gui by taking data from Simulink

조회 수: 5 (최근 30일)
Baris Bilen
Baris Bilen 2020년 9월 16일
댓글: Michael Bernstein 2020년 11월 7일
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일
One way to do this is using get_param to get data from run time objects
  댓글 수: 2
Jon
Jon 2020년 9월 16일
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
Michael Bernstein
Michael Bernstein 2020년 11월 7일
I suppose it is fastest real-time plot. Has Simulink linking example.
Well documented. World-wide known.

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

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by