5

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.

J Collins
  • 2,106
  • 1
  • 23
  • 30
  • mmmmm Not sure of what you are triying to do. Maybe the block callbacs can help you? http://www.mathworks.co.uk/help/simulink/ug/block-callbacks.html – Ander Biguri Jun 24 '14 at 14:37
  • The callbacks might help if I could find a signal to propagate to the block such that it could respond to it. – J Collins Jun 24 '14 at 14:41
  • So, whcich bock i chnging the "settings" (whatever you may mean with that word)? The question lacks a bit of information. Can you show a MWE and add a picture of it? – Ander Biguri Jun 24 '14 at 14:44
  • @AnderBiguri Information extended – J Collins Jun 24 '14 at 14:47
  • What about sending a signal across the workspace? add another wire with the information of that change and insert it in the other blocks. Will that work for you? Or you are looking for something more "elegant" (which may not exist)? – Ander Biguri Jun 24 '14 at 15:02
  • 1
    I would expect that to influence the runtime which wouldn't be very good. I might also expect that the code of the wire might be represented in the built model which for my realtime system would be much more unwelcome. I was hoping with all the clever 'Callback' architecture that this would be trivial. – J Collins Jun 24 '14 at 15:20
  • You are right. Im sorry i cannot hep you more. I hope you find an answer, as it is a vver interetig question – Ander Biguri Jun 24 '14 at 15:29

1 Answers1

1

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.

J Collins
  • 2,106
  • 1
  • 23
  • 30