Final constant from simulink to GUI

조회 수: 1 (최근 30일)
Jan
Jan 2012년 4월 5일
댓글: SMEAC 2017년 6월 28일
Hello,
i want to display results from simulink in GUI by "edit" textbox , is it possible by "Display" block in simulink and into GUI edit callback insert:
get_param('myprogram/Display', 'Value')
it doesnt work...
Thanks for your answers.

답변 (3개)

Kaustubha Govind
Kaustubha Govind 2012년 4월 5일
You can use get_param only to get block parameter values, not their output values (which are computed at every time-step). If you'd like for your GUI field to be updated continuously as the model is running, it is best to setup a PostOutputs method execution event. See Accessing Block Data During Simulation for more information.
  댓글 수: 2
Kyle
Kyle 2014년 5월 14일
Your hyper link no longer goes to a valid page. Is there a new location for the information?
SMEAC
SMEAC 2017년 6월 28일
I would suggest she was looking at this link: Accessing Block Data During Simulation

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


Jan
Jan 2012년 4월 11일
I have simulation with only with one step, so Id like to display final value in GUI by:
get_param('myprogram/Display', 'Value') ...
but get_param run correctly only for "constant block" but I need a number from Display or Outport.
Thanks for your answer.

TAB
TAB 2012년 4월 12일
get_param() & get_param() are used to read and set the block properties (attributes). No block directly returns its output value using get_param().
get_param('block','Value') run correctly for "Constant block" becuase 'Values' is one of the attribute which is passed before the start of simulation.
See Display block parameters which can be read or write by get_param() & set_param().
To access the output value in GUI use Sinks\To Workspace block which will save the output value to base workspace (after completion of simulation) which can be easily accessed in GUI.
Or, start a event listner as suggested by Kaustubha, which will return the output value during the simulation itself.

카테고리

Help CenterFile Exchange에서 Model, Block, and Port Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by