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 Mapping tool, which updates the Input parameter based on the signal data that you import and map to root-level input ports.

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

  • 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.

  • Signal Builder block — Create interchangeable groups of piecewise linear signal sources to use in a model.

To determine which approach to use, see Comparison of Signal Loading Techniques.


Inport Create input port for subsystem or external input
Enable Add enabling port to system
Trigger Add trigger port to model or subsystem
From File Load data from MAT-file
From Spreadsheet Read data from spreadsheet
From Workspace Load signal data from workspace
Signal Builder Create and generate interchangeable groups of signals whose waveforms are piecewise linear
Band-Limited White Noise Introduce white noise into continuous system
Chirp Signal Generate sine wave with increasing frequency
Clock Display and provide simulation time
Constant Generate constant value
Enumerated Constant Generate enumerated constant value
Counter Free-Running Count up and overflow back to zero after reaching maximum value for specified number of bits
Counter Limited Count up and wrap back to zero after outputting specified upper limit
Digital Clock Output simulation time at specified sampling interval
Ground Ground unconnected input port
Pulse Generator Generate square wave pulses at regular intervals
Ramp Generate constantly increasing or decreasing signal
Random Number Generate normally distributed random numbers
Repeating Sequence Generate arbitrarily shaped periodic signal
Repeating Sequence Interpolated Output discrete-time sequence and repeat, interpolating between data points
Repeating Sequence Stair Output and repeat discrete time sequence
Signal Generator Generate various waveforms
Sine Wave Generate sine wave, using simulation time as time source
Step Generate step function
Uniform Random Number Generate uniformly distributed random numbers
Waveform Generator Output waveforms using signal notations


getRootInportMap Create custom object to map signals to root-level inports
convertToSlDataset Convert contents of MAT-file to Simulink.SimulationData.Dataset object
getSlRootInportMap Create custom object to map signals to root-level inports using Simulink mapping mode
signalbuilder Create and access Signal Builder blocks
getInputString Create comma-separated list of variables to map
Simulink.BlockDiagram.getInitialState Return initial state structure of block diagram
Simulink.Bus.createMATLABStruct Create MATLAB structures using same hierarchy and attributes as bus signals
Simulink.SimulationData.createStructOfTimeseries Create a structure with MATLAB timeseries object leaf nodes

Simulink Configuration Parameters


Signal Loading Techniques

Overview of Signal Loading Techniques

Understand the techniques available for importing signal data into a model.

Comparison of Signal Loading Techniques

Determine the signal loading approach that meets your modeling requirements. In many cases, mapping signal data to root inports works well.

Load Data to Root-Level Input Ports

Load data from a workspace and apply it to a root-level input.

Map Data Using Root Inport Mapping Tool

To import, visualize, and map signal and bus data to root inports, use the Root Inport Mapping tool.

Generate MATLAB Scripts for Simulation with Scenarios

After associating a scenario with the model, generate a MATLAB® script to perform batch simulations.

Load Data Using the From File Block

Load signal data using a From File block.

Load Data Using the From Workspace Block

Load signal data using a From Workspace block.

Using Signal Loading in Models

Import Data to Model a Continuous Plant

Import signal data to a continuous plant model, which uses signal data that is smooth and uninterrupted in time, with a signal data for each time value.

Import Data to Test a Discrete Algorithm

Test a discrete algorithm by importing discrete signals, which are signals that you define using evenly-spaced time values. One signal value is read at each time step, using the sample time of the source block.

Import Data for an Input Test Case

When you import signal data for most input test cases, try to minimize the number of time points. The signal data that you load includes samples with ramps and discontinuities.

Load Signal Logging Data

Load signal logging data that was logged during a previous simulation.

Load Signal Data That Uses Units

Load signal data that uses units from data logged in a previous simulation. Signal logging, the To File block, and the To Workspace block can include units information for Dataset or Timeseries logging formats.

Was this topic helpful?