Main Content

保存仿真的运行时数据

保存仿真数据,如输出、信号、时间、状态和数据存储记录数据

在仿真期间,您可以将仿真数据保存到 MATLAB® 工作区或文件中,包括 MLDATX 文件、MAT 文件或 Excel® 文件,以便以后检索和后处理。仿真数据可以是输出、信号、时间、状态和数据存储记录数据的任意组合。

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

要确定应该使用哪种方法来记录数据,请参阅保存仿真数据

模块

Outport为子系统或外部输出创建输出端口
RecordLog data to the workspace, to a file, or both (自 R2021a 起)
To File将数据写入到文件
To Workspace将数据从 Simulink 模型记录到工作区

工具

插桩属性View and edit logging and visualization properties for logged signal
信号属性View and edit signal properties
仿真数据检查器检查并比较数据和仿真结果,以验证和迭代模型设计
Simulink 信号记录选择器View signal logging configuration and override signal logging settings

函数

全部展开

Simulink.sdi.markSignalForStreamingTurn logging on or off for signal
Simulink.sdi.getSignalInputProcessingModeGet value of Input Processing signal property (自 R2020a 起)
Simulink.sdi.setSignalInputProcessingModeSpecify value for Input Processing signal property (自 R2020a 起)
Simulink.SimulationData.ModelLoggingInfo.createFromModelCreate Simulink.SimulationData.ModelLoggingInfo object for top model with override settings for each logged signal in model
findSignalFind index of signals in Signals property vector
setLogAsSpecifiedInModelSet logging mode for top model or top-level Model block
getLogAsSpecifiedInModelDetermine whether model logs as specified in model or uses override settings
verifySignalAndModelPathsVerify paths in Simulink.SimulationData.ModelLoggingInfo object

配置记录的数据大小限制

Simulink.sdi.setMaxDiskUsageSpecify maximum size for data logged to disk (自 R2021a 起)
Simulink.sdi.getMaxDiskUsageGet configured maximum size for data logged to disk (自 R2021a 起)
Simulink.sdi.setRequiredFreeSpaceSpecify minimum disk space to leave free when logging data (自 R2021a 起)
Simulink.sdi.getRequiredFreeSpaceGet configured minimum disk space requirement for logging (自 R2021a 起)
Simulink.sdi.setDeleteRunsOnLowSpaceSpecify behavior when logged data size approaches configured limits (自 R2021a 起)
Simulink.sdi.getDeleteRunsOnLowSpaceGet configured behavior when size of logged data approaches configured limits (自 R2021a 起)
Simulink.sdi.setRecordDataSpecify record mode for logging (自 R2021a 起)
Simulink.sdi.getRecordDataCheck record mode for logging (自 R2021a 起)

配置仿真数据检查器存档

Simulink.sdi.setArchiveRunLimitSpecify number of runs to retain in Simulation Data Inspector archive
Simulink.sdi.setAutoArchiveModeSpecify how Simulation Data Inspector manages simulation runs
Simulink.sdi.getArchiveRunLimitGet limit for number of runs to retain in Simulation Data Inspector archive
Simulink.sdi.getAutoArchiveModeGet Simulation Data Inspector run management mode
Simulink.sdi.setStorageLocationSpecify location for logged data on disk (自 R2021a 起)
Simulink.sdi.getStorageLocationGet path to custom storage location for data logged to disk (自 R2021a 起)
Simulink.sdi.setStorageModeSpecify whether to log data to disk or memory (自 R2021a 起)
Simulink.sdi.getStorageModeCheck if logging is configured to log data to disk or memory (自 R2021a 起)
extractTimetableExtract data from Simulink.SimulationData.Dataset or Simulink.SimulationData.Signal objects into timetables (自 R2021b 起)
getAsDatastoreGet matlab.io.datastore.SimulationDatastore representation of element from referenced Dataset object
removeElementRemove element from Simulink.SimulationData.Dataset object
Simulink.SimulationData.createStructOfTimeseriesCreate structure of timeseries data to load as simulation input for bus
Simulink.SimulationData.forEachTimeseriesApply function to data contained in set of timeseries objects
Simulink.SimulationData.DatasetRef.getDatasetVariableNamesList names of variables in MAT file that contain Simulink.SimulationData.Dataset objects

对象

全部展开

Simulink.SimulationOutput访问仿真输出和元数据
Simulink.SimulationMetadataAccess metadata of simulation runs
Simulink.SimulationData.DatasetAccess logged simulation data or group simulation input data
Simulink.SimulationData.SignalContainer for signal logging information
Simulink.SimulationData.StateContainer for state logging information
Simulink.SimulationData.DatasetRefCreate Simulink.SimulationData.DatasetRef object
matlab.io.datastore.SimulationDatastoreDatastore for inputs and outputs of Simulink models
Simulink.SimulationData.BlockPathFully specified block path
Simulink.SimulationData.UnitContainer for units for simulation data
Simulink.SimulationData.LoggingInfoSignal logging override settings
Simulink.SimulationData.ModelLoggingInfoSignal logging override settings for model
Simulink.SimulationData.SignalLoggingInfoSignal logging override settings for signal

模型设置

全部展开

时间Option to log time values for simulation
输出Option to log data for top-level output ports
状态Option to log block state values during simulation
信号记录Option to log data for signals marked for logging in model
数据存储Option to log data for Data Store Memory blocks
最终状态Option to log final state values
保存最终工作点Option to save complete model operating point when simulation is paused or stopped
单一仿真输出Option to return simulation results as single Simulink.SimulationOutput object
格式Format for logged states, output, and final states data
将数据集数据记录到文件Option to log data that uses Dataset format to MAT file
在仿真数据检查器中记录所记录的工作区数据Option to send data logged in format other than Dataset to Data Inspector at end of simulation
抽取对记录的输出、状态和时间数据应用抽取因子的选项
将数据点限制为最后Option to log only last n data points for outputs, states, and time
记录间隔Option to specify time intervals in which to log simulation data
输出选项Options to produce output values at specified times in variable-step simulation
输出时间Option to specify times for which variable-step simulation produces output values
细化因子Option to produce additional output values between simulation time steps

主题

仿真数据

信号记录

大数据

仿真状态

数据存储

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