创建模块封装
自定义模块外观、用户界面和模块图
模块封装是您可以为模块创建的自定义用户界面。封装模块可隐藏其底层实现细节,并提供更用户友好的界面来设置参数和选项。模块封装对于复杂模块或子系统特别有用,这些模块或子系统的内部工作原理不需要用户理解或直接交互。您可以为自定义模块创建一个封装,并将其作为模块的唯一实例重用。
类
主题
封装简介
封装编辑器
- 封装编辑器概述
使用封装编辑器创建和自定义封装。 - 设计封装对话框
创建一个封装对话框。 - Handling Large Number of Mask Parameters
Add a large number of mask parameters in a table programmatically. - Customize Tables for Masked Blocks
Add custom tables to a mask dialog box. - Control Custom Table Programmatically
Use a programmatic interface to control custom tables. - 以编程方式控制封装
以编程方式指定和编辑模块封装。
封装功能
- Promote Block Parameters on a Mask
Promote an underlying block or subsystem parameter to its mask. - 使用数据类型参数指定编辑参数的数据类型
您可以使用数据类型参数为封装编辑参数指定可接受的数据类型。为编辑参数关联数据类型可为通过封装对话框提供的输入值定义规则。您还可以使用数据类型参数来关联编辑参数的最小值和最大值。您可以使用数据类型参数进行定点分析。 - 将值传递给封装下的模块
使用封装对话框指定输入值。 - Mask Linked Blocks
Add a custom interface to linked blocks. - Approaches to Control Active Variant Choice of a Variant Block Using Mask or Model Workspace
Control the active choice of inline variant and Variant Subsystem blocks from a mask or a model workspace. - Define Measurement Units for Masked Blocks
Set measurement units for output and input ports of a masked block. - 在掩膜中添加图像
添加图像作为掩膜图标并将其保存在 SLX 文件中。 - Create Hierarchical List in Mask Dialog
Use the hierarchical list of data on a mask. - Tune Mask Enumeration Parameters - Popup and Radio Button
Reference an external enumeration file to assign numerical values to popup parameter. - Visualize and Plot N-Dimensional Data Using Mask Lookup Table Control
Look-Up Table control refers to a block or a set of blocks that use pre-defined data to map input values to output values. - Preserve Tunability of Parameters That Are Modified or Created in Mask Initialization
Preserve the tunability of mask parameters in generated code. - Reuse Mask Parameters and Dialog Controls Across Multiple Masked Blocks
Use the Mask Part Reference container of the Mask Editor to create and save the parameters and dialog controls in an XML file. - Create Mask Parameter Structure to Simplify Tuning and Data Management
Create structure of mask parameters.
封装约束
- Validating Mask Parameters Using Constraints
Add validation to mask parameters using constraints. - Custom Constraint for Mask Parameter
Validate input to mask parameters using custom constraints. - Share Parameter Constraints Across Multiple Block Masks
Create a parameter constraint and share it across masks of different blocks in the same model or different models. - Validate Input and Output Port Signals Using Port Constraints
Validate compile-time signal attributes on the input and output ports of a masked block by using port constraints. - Validate Port Signals Among Ports of the Same Masked Block
Validate cross port constraints to validate compile-time signal attributes among ports of the same masked block. - Validate Port Signals and Parameter Values Using Cross Port Parameter Constraints
Use cross port parameter constraints to establish constraint among ports and parameters within the same masked block. - Share Port Constraints Across Multiple Masked Blocks
Create a port constraint and share it across masks of different blocks in the same model or different models. - Author Parameter and Port Constraints Using Standalone Constraint Manager
Manage multiple shared constraint files independently of a block context.
图形图标编辑器
- Graphical Icon Editor Overview
Graphical Icon Editor helps to create and edit mask block icon in a graphical environment. - Create and Edit Block Mask Icon
Create block mask icon using Graphical Icon Editor and Mask Drawing commands. - Add Dynamic Behavior to Masked Icons
Add dynamic behavior to masked icons using Graphical Icon Editor.
封装回调
- 封装初始化和参数回调代码简介
使用 MATLAB® 代码初始化模块封装。 - Author Mask Initialization and Callbacks
Write MATLAB code in the Mask Editor for mask initialization and callbacks. - Organize Mask Initialization and Callbacks in a MATLAB File
Organize mask initialization and mask callback code in a separate MATLAB® class file. - 动态封装对话框
为封装模块创建对话框,这些对话框的显示会根据用户输入而发生变化。 - 动态封装子系统
创建可以修改其结构性内容的封装库模块。 - Debug Masks That Use MATLAB Code
Troubleshoot errors in the mask initialization code.
系统封装
- Introduction to System Mask
Learn about masking a model. - 以编程方式控制封装
以编程方式指定和编辑模块封装。 - Create and Reference a Masked Model
Mask a model interactively. - Create and Display System Mask Programmatically
Apply a system mask to a model or a subsystem block diagram.
示例模型
- Masking Example Models
View Simulink® models that demonstrate masking capabilities.