Load Signal Data for Simulation
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.
Signal Data Loading
|Inport||Create input port for subsystem or external input|
|In Bus Element, Bus Element In||Select input from external port|
|Enable||Add enable port to subsystem or model|
|Trigger||Add trigger or function port to subsystem or model|
|From File||Load data from MAT file into Simulink model|
|From Spreadsheet||Read data from spreadsheet|
|From Workspace||Load signal data from workspace into Simulink model|
|Playback||Load data from workspace, file, or Simulation Data Inspector|
|Signal Builder||Create and generate interchangeable groups of signals whose waveforms are piecewise linear|
|Signal Editor||Display, create, edit, and switch interchangeable scenarios|
Signal Data Loading
|Create custom object to map signals to root-level inports|
|Convert contents of MAT-file to |
|Create custom object to map signals to root-level inports using Simulink mapping mode|
|Generate dataset object for root-level Inport or bus element ports in model|
|(Not recommended) Create and access Signal Builder blocks|
|Import signal data and properties from Signal Builder block to Signal Editor block|
|Create comma-separated list of variables to map|
|Return initial state data of block diagram|
|Create MATLAB structures that use the same hierarchy and attributes as buses|
|Create structure of |
|Start Signal Editor|
Paramètres du modèle
- Provide Signal Data for Simulation
Identify model signal data requirements and load input signal data.
- 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. Often, mapping signal data to root inports works well.
- 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.
- Load Data Logged In Another Simulation
Load signal data into a model that was logged in a previous simulation.
- Load 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.
- Load 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.
- Load 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 Data to Root-Level Input Ports
- Load Data to Root-Level Input Ports
Load data from a workspace and apply it to a root-level input.
- Load Bus Data to Root-Level Input Ports
Import bus data to top-level input ports by manually specifying the data in the Input configuration parameter or by using the Root Inport Mapper tool.
- Map Data Using Root Inport Mapper Tool
To import, visualize, and map signal and bus data to root inports, use the Root Inport Mapper tool.
- Map Root Inport Signal Data
Open the Root Inport Mapper Tool and select the map mode.
- Create Signal Data for Root Inport Mapping
Create data for root inport mapping using specific guidelines and conventions.
- Map Signal Data to Root Input Ports
Map signal data to root input ports by selecting map modes and options and selecting data. Interpret mapping results.
- Import Signal Data for Root Inport Mapping
Import signal and bus data for root inport mapping. You can also import test vectors from Simulink® Design Verifier™ environment.
- Create and Use Custom Map Modes
Create custom map modes if you do not want to use existing map modes in the Root Inport Mapper tool.
- Root Inport Mapping Scenarios
Work with scenarios in the Root Inport Mapper tool. Create and save scenarios, and load previously saved scenarios.
- Generate MATLAB Scripts for Simulation with Scenarios
After associating a scenario with the model, generate a MATLAB® script to perform batch simulations.
Other Signal Loading Techniques
- Load Input Data for a Bus Using In Bus Element Blocks
Load input data for a bus using In Bus Element blocks.
- Load Data Using the From Workspace Block
Load simulation input data using the From Workspace block.
- Load Data Using the From File Block
Create and save signal data to load from a MAT file using the From File block.
- Load Data Using Playback Block
Load data from the workspace, a file, and the Simulation Data Inspector using the Playback block.
- Load Big Data for Simulations
Load big data as simulation input.
- Stream Data from a MAT-File as Input for a Parallel Simulation
Stream input data for parallel simulations from a MAT-file.
- Load Data with Interchangeable Scenarios
Use Signal Editor block to work with interchangeable scenarios.
- Migrate from Signal Builder Block to Signal Editor Block
Consider replacing Signal Builder blocks with Signal Editor blocks.