Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force redraw of model icon

Version: MATLAB Simulink 2010b

How can I from code force a model subsystem icon to redraw itself. I have an icon displaying a model setting, however that block is not responsible for changing that setting. When the setting changes I would like to see the model block's display update. How can this be achieved?

Edit: More information

Imagine I have two masked subsystems in a model, one whose mask sets a global workspace variable, the other which displays the value at its icon. Ignoring the pointlessness of the example, I don't know of a way of sending a message/event to the system to inform other blocks to redraw themselves and in the process read the new workspace value.

like image 987
J Collins Avatar asked Nov 11 '22 05:11

J Collins


1 Answers

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

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

In the event source mask under the Initialisation tab, I call set_param on all the other masks' 'onSettingsChanged' value. When they get written with a different value from previous, this causes their mask to redraw.

like image 58
J Collins Avatar answered Nov 15 '22 08:11

J Collins