www.gusucode.com > simulink 案例源码程序 matlab代码 > simulink/MaskEditorOverviewExample.m

    %% Design Custom Interface Using Masking
%
%
%  Copyright 2016 The MathWorks, Inc.

%%
% In this example we create a mask dialog box and understand the use of some of the Mask Editor features. When you mask a block, you encapsulate the block logic and create a custom interface for the block.
%
% Consider a model containing a Subsystem block called AC system. This Subsystem contains an air conditioning system underneath.
%
%%

%model define
 model = 'ACSystem';
%open the model
 open_system(model);
 
%%


%%
% Let's apply a mask on this subsystem block.
%%
% <<../CreateMask.png>>
%%
%
% The Mask Editor has four panes. This example walks you through the Parameters & Dialogs pane. The Parameters & Dialogs pane has three sections, *Controls*, *Dialog box*, and *Property editor*.
%
% You can use the Parameters & Dialogs pane to add controls on the mask dialog box and manage the mask dialog box layout. Select items from the *Controls* section to add parameters to the mask dialog box. Use the *Property editor* section to edit the parameter properties.
%%
% <<../ParamaeterDialog.png>>
%%
%
% For example, click *Collapsible Panel* from *Controls* section.
%%
% <<../collapsiblePanel.png>>
%%
%
% Observe that a collapsible panel container is now added in the *Dialog box* section. In the *Prompt* column, type value to be displayed on the mask dialog box. 
% The *Name* column gets populated automatically when a control is added with the handle for that control. You can choose to change this value.
%
% Edit the properties of collapsible panel in the *Property editor*. Click *Preview* to view the mask dialog box as you build it.

%%
% <<../Preview.png>>
%%
%
% Similarly, you can add and configure various controls from the Mask Editor to build the mask dialog box. Let's now see the completed mask dialog box and map corresponding controls on the Mask Editor. 
%
%%
% <<../CompetedDialog.png>>
%%
%
% Observe the mask layout. Containers like group boxes, panels, collapsible panels, and tabs have been used to group the controls together. Here, the yellow box represents *Group Box*, the pink box represents *Tab*, and the green box represents the *Collapsible Panel*.
%%
% <<../MaskLayout.png>>
%%
% The *Button* controls type is used to create the *Power On* button on the mask dialog box. You can apply the Horizontal Stretch property for this button to manage its placement. You can also add callback code to be executed when the button is pressed.
%%
% <<../PowerOn.png>>
%%
% Collapsible panel for *Manufacturer's information* contains *Text* and *Hyperlink* control types.
%%
% <<../collapsiblePanel_text_link.png>>
%%
% You can manage the hyperlink path by adding MATLAB code as a callback.
%%
% <<../CallbackCode.png>>
%%
% The *General Controls* section contains tabs to segregate and categorize information under *Main Controls* and *Ancillary Controls*. The *Main Controls* tab uses *Dials* and *Slider* to accept inputs for air conditioner parameter.
% You can edit the property of dial and slider to place it horizontally or vertically.
%%
% <<../GeneralControls.png>>
%%
%
% The *Ancillary Controls* use *Popup*, *Check Box*, and *Radio Buttons*. 
%
%%
% <<../AncillaryControls.png>>
%%
%
% The *Advanced Controls* section is a collapsible panel and contains spinbox, minimum and maximum parameters to accept inputs. 
%
%%
% <<../AdvancedControl.png>>
%%
%
% For more information, see the topic *Mask Editor Overview*.
%%