Main Content

本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

保存仿真的运行时数据

将仿真数据保存到 MATLAB® 工作区;记录信号;导出信号、时间、输出和状态数据

您可以在仿真过程中将信号值保存到 MATLAB 工作区或 MAT 文件中,以便于在以后进行检索和后期处理。保存仿真数据也称为记录或导出仿真数据。

Dataset 格式为各种记录方法所记录的结果提供了一种通用的格式,因此以这种方式保存仿真数据可以简化后期处理。可以使用 Dataset 格式将数据存储为 MATLAB timeseries 对象,以便使用 MATLAB 进行处理。

  • 信号记录和数据存储使用 Dataset 格式。

  • 输出和状态记录使用 Dataset 作为默认格式。

  • To File 和 To Workspace 模块的默认保存格式为 Timeseries

Simulink® 提供了转换工具,可以将记录的数据转换为 Dataset 格式

要确定应该使用哪种方法来记录信号数据,请参阅导出仿真数据

模块

Outport为子系统或外部输出创建输出端口
To File将数据写入到文件
To Workspace将数据写入工作区

函数

全部展开

Simulink.sdi.markSignalForStreamingTurn logging on or off for a signal
Simulink.sdi.getSignalInputProcessingModeGet setting of Input Processing signal property
Simulink.sdi.setSignalInputProcessingModeSpecify value for Input Processing signal property
Simulink.SimulationData.createStructOfTimeseriesCreate structure of timeseries data to load as simulation input for bus
Simulink.SimulationData.forEachTimeseriesCall function on each timeseries object
Simulink.SimulationData.signalLoggingSelectorOpen Signal Logging Selector
Simulink.SimulationData.DatasetRef.getDatasetVariableNamesList names of Dataset variables in MAT-file
getAsDatastoreGet matlab.io.datastore.SimulationDatastore representation of element from referenced Dataset object
setNameSpecify name of logging data units
Simulink.ModelDataLogs.convertToDatasetConvert logging data from Simulink.ModelDataLogs format to Simulink.SimulationData.Dataset format
Simulink.SimulationData.updateDatasetFormatLoggingConvert model and its referenced models to use Dataset format for signal logging

全部展开

Simulink.SimulationOutput访问仿真结果的对象值
Simulink.SimulationData.Dataset创建 Simulink.SimulationData.Dataset 对象
Simulink.SimulationData.SignalContainer for signal logging information
Simulink.SimulationData.DatasetRefCreate Simulink.SimulationData.DatasetRef object
matlab.io.datastore.SimulationDatastoreDatastore for inputs and outputs of Simulink models
Simulink.SimulationData.BlockPathFully specified Simulink block path
Simulink.SimulationData.StateState logging element
Simulink.SimulationData.UnitStore units for simulation data
Simulink.SimulationData.LoggingInfoSignal logging override settings
Simulink.SimulationData.ModelLoggingInfoSignal logging override settings for a model
Simulink.SimulationData.SignalLoggingInfoSignal logging override settings for signal
Simulink.SimulationMetadataAccess metadata of simulation runs

主题

仿真数据

导出仿真数据

导出(记录)仿真数据作为分析和调试模型的基准。

记录的仿真数据的数据格式

您可以使用许多格式来记录数据,包括 Dataset、MATLAB 时序、数组和结构体。支持的数据格式因记录方法而异。但是,Dataset 格式可用于所有记录方法。

Dataset Conversion for Logged Data

To convert a workspace variable that contains data that was logged in a format other than Dataset format to use Dataset format, use a Simulink.SimulationData.Dataset constructor.

Work with Big Data for Simulations

Log, load, and analyze big data for simulations.

Limit Amount of Exported Data

Reduce the amount of data logged during a simulation.

Work with Big Data for Simulations

Log, load, and analyze big data for simulations.

Log Data to Persistent Storage

Store logged simulation data to persistent storage in a MAT-file.

Load Big Data for Simulations

Load big data as simulation input.

Analyze Big Data from a Simulation

Access simulation data logged to persistent storage for analysis in MATLAB.

Log Signal Data That Uses Units

Log signal data that uses units by using Dataset or Timeseries logging format for signal logging, the To File block, and the To Workspace block.

模型配置参数:Data Import/Export

使用 Data Import/Export 类别的模型配置参数指定要记录的仿真结果以及如何格式化和显示记录输出。

仿真状态

State Information

How blocks use the state information for calculating the output signal value for the current simulation step.

Save State Information

Save state information for logged states for each simulation step during a simulation.

MATLAB 工作区

Limit Amount of Exported Data

Reduce the amount of data logged during a simulation.

Samples to Export for Variable-Step Solvers

Control how much output the simulation generates when your model uses a variable-step solver. Use the Output options configuration parameter.

信号日志记录

使用信号记录导出信号数据

要从仿真中捕获信号数据,可以使用信号记录。标记要记录的信号,并为模型启用信号记录。

配置信号记录

标记您要记录仿真数据的信号。

View the Signal Logging Configuration

View the signals that are marked for signal logging.

为模型启用信号记录

要记录标记的信号,请设置 Signal logging 配置参数。

Override Signal Logging Settings

For a specific simulation run, override the signal logging settings for individual signals marked for logging.

查看和访问信号记录数据

查看和访问完成或暂停的仿真的信号记录数据。

Convert Logged Data to Dataset Format

To convert a workspace variable that contains data that was logged in a format other than Dataset format to use Dataset format, use a Simulink.SimulationData.Dataset constructor.

Log Signals in For Each Subsystems

Use signal logging in For Each subsystems.

数据存储

Log Data Stores

Configure a data store for logging so that you can view the data stored in a simulation run.

特色示例