Main Content

Load Signal Data for Simulation

Load signal data for simulating a model

You can use several different approaches to load data into a model, including:

  • Root-level input ports — Import signal data from a workspace, using the Input configuration parameter to import it to a root-level input port of a Inport, Enable, or Trigger block. To import many signals to root-level input ports, consider using the Root Inport Mapper tool.

  • From File block — Read data from a MAT file, outputting the data as a signal.

  • From Spreadsheet block — Read data from Microsoft® Excel® spreadsheets or CSV spreadsheets, outputting the data as one or more signals.

  • Playback block — Load data from the workspace, a file, or the Simulation Data Inspector.

  • Source blocks — Add a source block, such Sine Wave block, to generate signals to input to another block.

  • Signal Editor block — Display, create, edit, and switch interchangeable scenarios.

  • Persistent data — Stream big data from a MAT file into a model.

You can create input signal data in a file, workspace variable, or model parameter. You can use data logged in a previous simulation, from another source, or create the data yourself. To determine which signal loading approach to use, see Comparison of Signal Loading Techniques.

Blocks

expand all

InportCreate input port for subsystem or external input
In Bus Element, Bus Element InSelect input from external port
EnableAdd enable port to subsystem or model
TriggerAdd trigger or function port to subsystem or model
From FileLoad data from MAT file into Simulink model
From SpreadsheetRead data from spreadsheet
From WorkspaceLoad signal data from workspace into Simulink model
PlaybackLoad data from workspace, file, or Simulation Data Inspector (Since R2022b)
Signal EditorDisplay, create, edit, and switch interchangeable scenarios

Functions

expand all

createInputDatasetGenerate dataset object for root-level Inport or bus element ports in model
Simulink.Bus.createMATLABStructCreate MATLAB structures that use the same hierarchy and attributes as buses
Simulink.SimulationData.createStructOfTimeseriesCreate structure of timeseries data to load as simulation input for bus
getRootInportMapCreate custom object to map signals to root-level inports
getInputStringCreate comma-separated list of variables to map
convertToSLDatasetConvert contents of MAT-file to Simulink.SimulationData.Dataset object
getSlRootInportMapCreate custom object to map signals to root-level inports using Simulink mapping mode
signalEditorStart Signal Editor
signalBuilderToSignalEditorImport signal data and properties from Signal Builder block to Signal Editor block

Tools

Root Inport MapperImport, visualize, and map signal and bus data to root-level inports

Model Settings

InputOption to load external input data for simulation using top-level input ports

Topics

Signal Loading

Load Data to Root-Level Input Ports

Other Signal Loading Techniques