Force redrawing a model icon

Version: MATLAB Simulink 2010b

How can I get the code to make the model subsystem icon redraw. I have an icon that displays the model parameter, however this block is not responsible for changing this parameter. When changing the settings, I would like to see an update of the display of the model block. How can this be achieved?

Edit: Additional Information

Suppose I have two masked subsystems in a model, one of which is a global workspace variable, the other that displays the value on the icon. Ignoring the pointlessness of the example, I don’t know how to send a message / event to the system to tell other blocks about the need to redraw itself and in the process read the new value of the workspace.

+4
source share
1 answer

The answer to this was to create a new mask on the target block to be redrawn and add a variable in the options tab.

I called my 'onSettingsChanged' variable an event handler, setting it as Type: edit, Evaluate: off, Tunable: on.

In the event source mask on the Initialization tab, I call set_param for all the other "onSettingsChanged" values ​​of other masks. When they are written with a different value from the previous one, this forces their mask to redraw.

0
source

Source: https://habr.com/ru/post/1545840/


All Articles