## File Exchange Pick of the Week

Posted by Greg Wolff,

Greg's pick this week is Dynamic Mask Field Changing From Selected Pulldown Menu by David Manegold.

Ever wanted to change how your Simulink block mask appears depending on certain parameter conditions of the mask? David has a nice example.

I selected this submission because it demonstrates an advanced Simulink development technique in a straight-forward manner.

### Contents

#### Change Thy Appearance, and Quick!

Masks have the ability to change what parameters are available depending on which parameters have been selected. In this example, if the value of the "Selector" parameters is "A" then the set of parameters associated with "A" appears in the mask. But if you select "C" instead, then a new set of parameters is displayed. Also option "C" has a subset of parameters that can also change depending on what you choose for "C alt field type 3".

#### What Doest Thou Hide Behind the Mask?

The mask is a dialog box that appears when you double-click on a block in Simulink. It provides a means to enter parameters for a Simulink block or subsystem to affect its functionality. This means you can have two instances of a block or subsystem in the same model that exhibit different behavior depending on the parameter values entered in the mask. You can create your own masks for subsystems or blocks by right-clicking on the block and select

David leverages two capabilities to enable this behavior in a block mask.

2. The MaskVisibilities property of the block

In the mask editor, if you select a parameter to edit, you can populate the "Dialog callback" field to execute MATLAB functions that get executed when the parameter is changed in the block mask.

Within the callback function ChangeMaskFields, David changes the visibility of specific parameters based on the value of the "Selector" parameter. He defaults the parameter visibilities to "off":

[M{:}]=deal('off');


except for the first parameter (which is the Selector parameter):

M{1}='on';


Then he enables specific parameters based on the value of the "Selector" parameter:

[M{i0:ie}]=deal('on');