Documentation

Create a Simple Mask

You can mask a block interactively by using the Mask Editor or mask it programmatically. This example describes how to mask a block by using the面具编辑器。要以编程方式掩盖块,请参阅Control Masks Programmatically

For masking examples, seeSimulink Masking Examples

Step 1: Open Mask Editor

  1. 打开要掩盖块的模型。例如,打开subsystem_example

    该模型包含一个子系统块,该块对行的方程进行建模:y = mx + b

  2. 右键单击子系统块并选择Mask>创建口罩

Step 2: Define the Mask

The面具编辑器contains four tabs that enable you to define the block mask and customize the dialog box for the mask.

有关每个窗格的详细信息,请参阅面具编辑器Overview

图标和端口选项卡

Use this tab to create an icon for the block mask. You can use theOptionspane on the left to specify icon properties and icon visibility.

Add an image to the block mask.

  1. 在里面块框架下拉框,选择Visible

  2. 在里面Icon transparency下拉框,选择Opaque

  3. 在里面Icon units下拉框,选择Autoscale

  4. To restrict the icon rotation, selectFixedfrom theIcon rotationlist.

  5. 在里面图标绘制命令text box, type,

    x = [0 0.5 1 1.5];y = [0 0.5 1 1.5]; % An example to defines the variables x and y plot(y,x) % Command to plot the graph

    For more information on drawing command syntax, see图标绘制命令

  6. To save the changes, clickApply。预览块蒙版图标而不退出面具编辑器, click预习

不te

有关详细信息,请参阅Icon & Ports Pane

You can create static or dynamic block mask icons. For more information, seeDraw Mask IconslexMaskDisplayAndInitializationExample

Parameters & Dialog Tab

使用此选项卡将诸如参数,显示和操作项之类的控件添加到“掩码”对话框。

To addEditboxes to the block mask.

  1. 在左窗格中,下面Parameter, clickEdittwice to add two new rows in theDialog box窗格。

  2. TypeSlope截距在里面PromptNamecolumns, respectively. The value that you enter inPrompt列出现在“蒙版”对话框上。您输入的价值Namecolumn is the mask parameter name. The mask parameter name must be a valid MATLAB®name.

  3. 在右窗格中,下面属性编辑器,在Properties,Dialog, 和Layoutsections.

  4. ClickApply

  5. To preview the mask dialog box without exiting the Mask Editor, click预习

不te

有关详细信息,请参阅参数和对话窗格

Initialization Tab

Use this pane to specify MATLAB code to control the mask parameters. You can add conditions for the user specified values, provide a predefined value for a mask parameter, and so on.

考虑方程式y = mx + b。允许积极价值m,您可以在初始化窗格中添加MATLAB代码,以指定可接受的范围mas greater than zero.

不te

有关详细信息,请参阅Initialization Pane

Documentation Tab

Use this tab to add a name, description, and additional information for the mask.

TheDocumentationtab contains these fields:

  1. Type: You can add a name for the block mask in this box. The mask name appears on top of the mask dialog box. You cannot add new lines.

  2. Description: You can add a description for the block mask in this box. By default, the description is displayed below the mask name, and it can contain new lines and spaces.

  3. Help。You can add additional information for the block mask in this box. You clickHelp在“掩码”对话框上,显示此信息。您可以使用纯文本,HTML和图形,URL和Web或eval命令来添加信息Helpfield.

    After you have added information in the面具编辑器, clickApply或者好的

    块现在被掩盖了。

不te

有关详细信息,请参阅Documentation Pane

Step 3: Operate on Mask

  1. You can preview the mask and choose to unmask the block or edit the block mask.

  2. Double-click the masked block.

    出现“面具对话框”。

  3. Type values in theSlope截距boxes of the mask dialog box. To view the output, simulate the model.

  4. Click好的

  5. To edit the mask definition, right-click the block and selectMask>编辑面具。For more information, see管理现有的口罩

  6. Right-click the masked block and selectMask>Look Under Maskto view:

    • The blocks inside the masked subsystem

    • The built-in block dialog box of a masked block

    • 链接蒙版的基本面具对话框

See Also

|||

这个话题有帮助吗?