| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
| On this page… |
|---|
Supported Types for Frame-Based Data Adding Frame-Based Data in Embedded MATLAB Function Blocks Examples of Frame-Based Signals in Embedded MATLAB Function Blocks |
Embedded MATLAB Function blocks can input and output frame-based signals in Simulink models. A frame of data is a collection of sequential samples from a single channel or multiple channels. To generate frame-based signals, you must install Signal Processing Blockset. For more information about using frame-based signals, see Frame-Based Signals in the Signal Processing Blockset documentation.
Embedded MATLAB Function blocks automatically convert incoming frame-based signals as follows:
Converts single-channel frame-based signals to MATLAB column vectors
Converts multichannel frame-based signals to two-dimensional MATLAB matrices
An M-by-N frame-based signal represents M consecutive samples from each of N independent channels. N-Dimensional signals are not supported for frames.
To convert matrix or vector data to a frame-based output, Embedded MATLAB provides a data property called Sampling mode that lets you specify whether your output is a frame-based or sample-based signal for downstream processing.
Embedded MATLAB Function blocks accept frame-based signals of any data type except bus objects. For a list of supported types, see Supported Variable Types in the Embedded MATLAB documentation.
To add frame-based data to an Embedded MATLAB Function block, follow these steps:
Add an input or output, as described in Adding Data to an Embedded MATLAB Function Block.
If your data is an output, set Sampling mode to Frame based.

Note For more information on how to set data properties, see Defining Data in the Model Explorer. |
This topic presents examples of how to work with frame-based signals in Embedded MATLAB Function blocks.
In the following example, an Embedded MATLAB Function block multiplies all the signal values in a frame-based single-channel input by a constant value and outputs the result as a frame. The input signal is a sine wave that contains 5 samples per frame. Here is the model:

In the Embedded MATLAB Function block, input u and output y inherit size, complexity, and data type from the input sine wave signal, a 5-by-1 vector of signed, generalized fixed-point values. For y to output a frame of data, you must explicitly set Sampling mode to Frame based (see Adding Frame-Based Data in Embedded MATLAB Function Blocks). When you simulate this model, the Embedded MATLAB Function block multiplies each input signal by 3 and outputs the result as a frame.
In the following example, an Embedded MATLAB Function block adds a channel to a frame-based single-channel input and outputs the multichannel result. The input signal is a sine wave that contains 8 samples per frame. Here is the model:

In the Embedded MATLAB Function block, input u and output y inherit size, complexity, and data type from the input sine wave signal, an 8-by-1 vector of signed, generalized fixed-point values. For y to output a frame of data, you must explicitly set Sampling mode to Frame based(see Adding Frame-Based Data in Embedded MATLAB Function Blocks). Local variable a defines a second column on the matrix which will be output as a frame and interpreted as a second channel by downstream blocks. When you simulate this model, the Embedded MATLAB Function block outputs the new multichannel signal.
![]() | Using Enumerated Data in Embedded MATLAB Function Blocks | Using Traceability in Embedded MATLAB Function Blocks | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |