This is machine translation

Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Translate This Page

MathWorks Machine Translation

The automated translation of this page is provided by a general purpose third party translator tool.

MathWorks does not warrant, and disclaims all liability for, the accuracy, suitability, or fitness for purpose of the translation.

Overview of Signal Loading Techniques

Simulink® provides several techniques for importing signal data into a model. Each of the
signal data loading techniques uses blocks to represent signal data sources visually.

For additional details about which technique to use to meet specific modeling
requirements, see Comparison of Techniques.

Source Blocks

You can add a source block, such as a Sine Wave block, to generate
signals to input to another block. To specify how to generate the signal, use the Block
Parameters dialog box. For example, in the Sine Wave Block Parameters dialog
box, you can specify the sim function to use and time-based or
sample-based data.

The output data types of source blocks vary. For example, a Sine Wave
block outputs a vector of real doubles.

Recommended Uses

Do initial prototyping in a model, when the generated signal data serves your
modeling requirements

Avoid creating the data manually.

Reduce memory consumption. Source blocks do not store signal data.

Make the kind of signal data visually clear in the model.

Limitations

Source blocks generate signals based on a predefined algorithm. To use actual data
from an external source or to test a model without having to modify the model, use a
different signal loading technique.

Root-Level Input Ports

You can import signal data from a workspace and apply it to a root-level input port
using one of these blocks:

Trigger block that has an edge-based
(rising, falling, or either) trigger type

The root-level input ports load external inputs from the MATLAB® (base), model, or mask workspace. These blocks import data from the workspace
based on the value of the Configuration Parameters > Data Import/Export > Input parameter or a sim command argument. For an example, see
Load Data to Model a Continuous Plant.

To import many signals to root-level input ports, consider using the Root Inport Mapper
tool. This tool updates the Input configuration parameter based on the
signal data that you import and map to root-level input ports. For an example, see Map Data Using Root Inport Mapper Tool.

Recommended Uses

Use root input ports to:

Import many signals to many blocks

Test your model as a referenced model in a wider context with signals from the
workspace, without modifying your model

Displays signal data for you to inspect without loading all the signal data into
MATLAB memory

Provides memory-efficient signal viewing

Requirements

To ensure that the Simulink variable solver executes at the times that you specify in the imported data,
set the Configuration Parameters >
Data Import/Export > Additional parameters >
Output options parameter to Produce additional output.

Limitations

You cannot use input ports to import buses in external modes. To import bus data
in rapid accelerator mode, use Dataset format.

Code generation that involves building ERT or GRT targets, or using SIL or PIL
simulation modes, has some special considerations. See Code Generation.

From Spreadsheet Block

The From Spreadsheet block reads data from Microsoft®
Excel® spreadsheets (all platforms) or CSV spreadsheets (Microsoft
Windows® platform with Microsoft Office only) and outputs the data as one or more signals.

Recommended Uses

Use the From Spreadsheet block for loading:

Large Microsoft
Excel or CSV spreadsheets. The From Spreadsheet block
incrementally reads data from the spreadsheet during simulation, rather than loading
the data into Simulink memory.

Spreadsheets that you expect to modify. The From Spreadsheet block
handles changes to worksheet values automatically, because it loads data directly from
the spreadsheet.

Limitations

Linux® and Mac platforms do not support using a From Spreadsheet block to import data
from a CSV spreadsheet.

From Workspace Block

The From Workspace block reads signal data from a workspace and outputs
the data as a signal. In the Block Parameters dialog box, in the Data
parameter, enter a MATLAB expression that specifies the workspace data.