From: josar Sobota on 28 Apr 2010 09:33 Hi all, I am trying to create a 'smart' mask for my Simulink block - I need a functionality similar to the Constant block: Display the value of a parameter if it fits inside the block, otherwise display some text (if the number is too long). Based on the actual width of the block I can prepare the string to be displayed within the Initialization commands and display it using Icon drawing commands. Everything works fine except when resizing the block - the Initialization commands do not execute upon resizing the block and thus the displayed string does not change. I have to manually update the diagram, rotate the block or run the simulation in order to update the block icon. I am using Simulink 2008a, in previous versions of Matlab the initialization commands were executed on resize as well. So my question is whether there exists some way to force the initialization commands to execute when the block is resized... Thanks for any hints, Josar
From: Guy Rouleau on 29 Apr 2010 18:08 "josar Sobota" <josar(a)centrum.cz> wrote in message <hr9deg$5f4$1(a)fred.mathworks.com>... > Hi all, > I am trying to create a 'smart' mask for my Simulink block - I need a functionality similar to the Constant block: Display the value of a parameter if it fits inside the block, otherwise display some text (if the number is too long). > Based on the actual width of the block I can prepare the string to be displayed within the Initialization commands and display it using Icon drawing commands. Everything works fine except when resizing the block - the Initialization commands do not execute upon resizing the block and thus the displayed string does not change. I have to manually update the diagram, rotate the block or run the simulation in order to update the block icon. I am using Simulink 2008a, in previous versions of Matlab the initialization commands were executed on resize as well. > So my question is whether there exists some way to force the initialization commands to execute when the block is resized... > > Thanks for any hints, > Josar Hi, The MoveFcn block callback is triggered everytime a block is resized: http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/ug/f4-122589.html You should be able to trigger your code from this callback. HTH, Guy
From: josar on 30 Apr 2010 07:22 > > Hi, > > The MoveFcn block callback is triggered everytime a block is resized: > > http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/ug/f4-122589.html > > You should be able to trigger your code from this callback. > > HTH, > Guy Hi, thanks for your hint. The MoveFcn callback seems nice, unfortunatelly I am not able to redraw the block mask using this callback. Is it possible to trigger the initialization commands from within the MoveFcn callback? With kind regards, josar
|
Pages: 1 Prev: a MATLAB command like '_kbhit' in C Next: Pulse Density Demodulation |