管理设计数据
使用模型工作区、符号、数据对象和数据类来指定变量值
您可以使用 MATLAB® 变量来配置和管理模型中的信号和模块参数。有关模型如何使用变量的详细信息,请参阅符号解析。要创建、编辑和管理变量,请参阅创建、编辑和管理工作区变量。
您可以将模型变量存储在 MATLAB 基础工作区、模型工作区或数据字典中。要决定在何处存储模型变量,请参阅确定在何处存储 Simulink 模型的变量和对象。
要使用变量来控制信号和参数特征,如数据类型和代码生成设置,您可以将数据对象存储在工作区或数据字典中。请参阅数据对象。
函数
类
主题
数据存储在模型工作区中
- 模型工作区
将模型使用的变量和对象放置在只有该模型可以访问的工作区中。 - 更改模型工作区数据
当您将数据存储在模型工作区中时,可以选择数据源,例如,模型文件或外部 MAT 文件。要在数据源中修改变量,可以使用不同的过程,具体取决于您选择的数据源类型。 - 在模型工作区中指定数据源
将模型使用的变量和对象存储在模型文件或单独文件中。(可选)将变量和对象存储为您可修改的代码。
数据存储在字典中
- 什么是数据字典?
使用数据字典存储模型的外部数据。 - Import and Export Dictionary Data
Migrate data between a data dictionary and a MAT-file or MATLAB script file. - View and Revert Changes to Dictionary Data
Use a data dictionary to inspect and manage changes to model data. - 迁移模型以使用 Simulink 数据字典
将变量和对象存储在数据字典中。 - Partition Dictionary Data Using Referenced Dictionaries
Create referenced dictionaries to store subsets of the data that a model or model hierarchy uses. - Partition Data for Model Reference Hierarchy Using Data Dictionaries
Compose a dictionary hierarchy based on a model reference hierarchy. - Attach Data Dictionary to Custom Libraries
Share data objects with Simulink block library users using attached data dictionary. - Attach Data Dictionary to Subsystem Reference
Use a Simulink® data dictionary with child blocks and instances of your subsystem file. - Enumerations in Data Dictionary
Store enumerated type definitions and enumerated data in a data dictionary. - 以编程方式将数据存储到字典中
使用脚本和命令提示符创建数据字典并与之进行交互。
对象和变量中的数据存储
- 确定在何处存储 Simulink 模型的变量和对象
模型数据是指您在工作区(例如,基础工作区或数据字典)中创建的对象和变量。选择一种永久存储数据的方式。 - 创建、编辑和管理工作区变量
工作区变量使您能够在模块和模型之间共享信息,例如参数值和数据类型。使用不同工具和方法来创建和操作工作区变量。 - 使用模型资源管理器编辑和管理工作区变量
查找模型或模块使用的工作区变量、查找使用某个变量的模块、查找未使用的变量,以及重命名模块在任意位置使用的某个变量。在单独的文件中保存和加载变量。 - 数据对象
通过使用外部数据对象,在模块图外部指定参数、信号和状态的属性,包括参数值。 - 符号解析
您可以控制模型中的模块如何将符号解析为您在工作区中创建的变量和对象。 - 定义数据类
通过创建您自己的数据对象类,自定义您的模型与数据(信号、参数和状态)之间的交互方式。 - Upgrade Level-1 Data Classes
Simulink no longer supports level-1 data classes. You must upgrade data classes that you created using the level-1 data class infrastructure, which was removed in a previous release.
外部文件中的数据存储
- Create External File Adapter for Loading Variables into Simulink.SimulationInput Object
Define a custom file adapter that can be used by Simulink to load variables from an external file source into aSimulink.SimulationInput
object.