Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Solutions Academia Support User Community Company
spacer spacer spacer spacer spacer spacer

Technical Solutions

How do I create a popup control to set the mask block parameters in a masked subsystem in Simulink?


Date Last Modified: Friday, June 26, 2009
Solution ID:   1-192MA
Product:   Simulink
Reported in Release:   R12.1
Platform:   All Platforms
Operating System:   All OS
 

Subject:

How do I create a popup control to set the mask block parameters in a masked subsystem in Simulink?

Problem Description:

How do I create a popup control to set the mask block parameters in a masked subsystem in Simulink?

The Pop-up control should allow me to set the Mask block parameters to either DEFAULT or USER-DEFINED.

Solution:

You need to define a Popup control variable in the mask. The Popup control variable will enable you to toggle between the 'Default set' and a 'User-Defined' set. Set the Assignment Field of the Variable to 'Literal'. Then define the Popup Strings as follows:


Default|UserDefined

For help on Popup Control, please refer to the "How Masked Parameters are Stored" section at the following URL:

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/slref/f23-18517.html

Use the Initialization commands field in the mask to define the Default Masked parameters. Please take a look at sample code below. The code uses a Dynamic dialog to set the MaskValues to Default Values. The mask has a Popup control variable and 2 parameters. The Default Value of the parameters in this case are set to '1' and '1' by using set_param. Note that, the Mask values are specified as cell arrays.

if (strcmp(def,'Default'))
set_param(gcb,'MaskValues',{'Default','1','1'})
end

Creating Dynamic dialogs for masked blocks is discussed in detail on Pages 7-28 to 7-30 of Using SIMULINK Version 4 manual. Help on Dynamic dialogs can also be found at the following URL:

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/ug/f8-29468.html

Please provide feedback to help us improve this Solution
Contact support
E-mail this page
Print this page