文件

信号加载技术概述

金宝app®提供了几种用于将信号数据导入模型的技术。每个信号数据加载技术使用块在视觉上表示信号数据源。

为了additional details about which technique to use to meet specific modeling requirements, see技术比较

源码块

You can add a source block, such as a正弦波块,生成信号以输入到另一个块。要指定如何生成信号,请使用“块参数”对话框。例如,在正弦波Block Parameters dialog box, you can specify theSIM使用和基于时间的或基于样本的数据。

这output data types of source blocks vary. For example, a正弦波块输出实际双倍的向量。

为了an example of using a source block, see在Simulink编辑器中构建和编辑模型金宝app

Recommended Uses

  • 当生成的信号数据服务于您的建模要求时,在模型中进行初始原型设计

  • 避免手动创建数据。

  • Reduce memory consumption. Source blocks do not store signal data.

  • Make the kind of signal data visually clear in the model.

Limitations

源块基于预定义算法生成信号。要从外部源使用实际数据或测试模型而无需修改模型,请使用不同的信号加载技术。

根级输入端口

You can import signal data from a workspace and apply it to a root-level input port using one of these blocks:

根级输入端口从MATLAB加载外部输入®(基地)、模型或面具工作区。这些块import data from the workspace based on the value of the配置参数>Data Import/Export>Inputparameter or aSIMcommand argument. For an example, seeLoad Data to Model a Continuous Plant

要将许多信号导入根级输入端口,请考虑使用root Inport Mapper工具。此工具更新Inputconfiguration parameter based on the signal data that you import and map to root-level input ports. For an example, seeMap Data Using Root Inport Mapper Tool

Recommended Uses

Use root input ports to:

  • 将许多信号导入许多块

  • 在具有来自工作区的信号的更广泛的上下文中将模型作为引用的模型测试,而无需修改您的模型

为了importing signal data to meet most modeling requirements and to maintain model flexibility, root-level inport mapping is a convenient technique. Root-level inport mapping:

  • 显示用于检查的信号数据,而无需将所有信号数据加载到MATLAB存储器中

  • Provides memory-efficient signal viewing

Requirements

要确保Simulink变量求解器在您在金宝app导入的数据中指定的时间执行,请设置配置参数>
Data Import/Export
>一种dditional parameters>
输出选项
参数到Produce additional output

Limitations

  • You cannot use input ports to import buses in external modes. To import bus data in rapid accelerator mode, useDataset格式。

  • 根Inport Mapper工具支持的地图模式取决于信号金宝app的数据类型。有关详细信息,请参阅Choose a Base Workspace and MAT-File Format

从文件Block

一种从文件block reads data from a MAT-file and outputs the data as a signal.

为了an example, see从文件Block Loading Timeseries Data

Recommended Uses

Consider using a从文件加载块:

  • 大量数据。对于版本7.3 Mat文件,从文件在模拟期间,阻止从MAT文件逐步加载数据。

    提示

    将Version 7.0文件转换为V7.3(例如,my_data_file.mat.that contains the variablevar),在Matlab命令行,输入:

    加载('my_data_file.mat')保存('my_data_file.mat','var','-v7.3')
  • Data that was exported to a文件block. The从文件块读取由a写入的数据文件block without any you modifying the data or making other special provisions.

  • Data stored in a MAT-file that is separate from the model file.

Limitations

  • 为了版本7.0or earlier MAT-file, the从文件块仅读取Array-Format数据。

  • 版本7.3和版本7.0或早期的Mat文件以不同的方式处理多个变量。看MAT文件变量

  • 从文件块支持在MA金宝appTLAB中读取非传中的总线信号时间序列格式。

  • 为了array data, the从文件块只读取双信号数据。

  • Code generation that involves building ERT or GRT targets, or using SIL or PIL simulation modes, has some special considerations. See代码生成

From Spreadsheet Block

From Spreadsheetblock reads data fromMicrosoft®excel.®电子表格(所有平台)或CSV电子表格(Microsoft Windows®平台微软办公软件仅)并将数据输出为一个或多个信号。

Recommended Uses

使用From Spreadsheet加载块:

  • LargeMicrosoft Excelor CSV spreadsheets. TheFrom Spreadsheetblock incrementally reads data from the spreadsheet during simulation, rather than loading the data into Simulink memory.

  • 您希望修改的电子表格。这From Spreadsheetblock handles changes to worksheet values automatically, because it loads data directly from the spreadsheet.

Limitations

  • You cannot import bus data.

  • 来自电子表格文件具有电子表格数据的要求。使用所描述的格式组织Excel电子表格数据Supported Microsoft Excel File Formats

  • Linux.®andMacplatforms do not support using a From Spreadsheet block to import data from a CSV spreadsheet.

来自工作区块

来自工作区block reads signal data from a workspace and outputs the data as a signal. In the Block Parameters dialog box, in theDataparameter, enter a MATLAB expression that specifies the workspace data.

有关如何使用从工作区块的示例,请参阅Use From Workspace Block for Test Case

Recommended Uses

使用来自Workspace块进行加载:

  • 一小集信号数据,用于执行本地,临时测试

  • Data from the MATLAB (base), model, mask, or function workspace

  • Variable-size signals

  • Data that you saved using a To Workspace block in MATLAB时间序列格式,没有手动更改数据

  • Data saved in a previous simulation by aTo Workspace块两者时间序列or结构与时间format for use in a later simulation

Limitations

  • 这data expressions that you specify must evaluate to one of these types of data:

    • 麦克拉布时间序列目的

    • 一种structure of MATLAB时间序列对象

    • 一种n array or structure containing an array of simulation times and corresponding signal values

信号编辑器块

Using a信号编辑器块,您可以在模型中创建可互换的场景。

为了examples of how to use a信号编辑器block, see:

Recommended Uses

使用信号编辑器块创建和加载用于测试的方案。

这se products integrate the信号编辑器阻止他们的工作流程:

  • Simulink Test™

  • 金宝appSimulink Coverage™

  • 金宝appSimulink Design Verifier™

Limitations

  • Function-calls

  • 一系列公共汽车

  • 使用快速加速器模式的公共汽车

  • 时间表对象

  • Ground signals

信号编辑器块支持动态字金宝app符串。它不支持最大长度的字符串金宝app。另外,字符串信号编辑器block cannot output:

  • 非标量matlab字符串。

  • 包含缺失值的字符串数据。

  • 包含非ASCII字符的字符串数据。

相关例子

更多关于