Main Content

Deep Learning with Simulink

R2026b
Extend deep learning workflows using Simulink

Implement deep learning functionality in Simulink® models by using blocks from the Deep Neural Networks, Python Neural Networks, and Deep Learning Layers block libraries, included in the Deep Learning Toolbox™, or by using the Deep Learning Object Detector block from the Analysis & Enhancement block library included in the Computer Vision Toolbox™.

To generate a Simulink model that uses the Deep Learning Layers block library to represent a network, use the exportNetworkToSimulink function. Blocks from the Deep Learning Layers block library support code generation.

Some deep learning functionality in Simulink uses a MATLAB Function block that requires a supported compiler. For most platforms, a default C compiler is supplied with the MATLAB® installation. When using C++ language, you must install a compatible C++ compiler. To see a list of supported compilers, open Supported and Compatible Compilers, click the tab that corresponds to your operating system, find the Simulink Product Family table, and go to the For Model Referencing, Accelerator mode, Rapid Accelerator mode, and MATLAB Function blocks column. If you have multiple MATLAB-supported compilers installed on your system, you can change the default compiler using the mex -setup command. See Change Default Compiler.

By default, blocks from the Deep Neural Networks block library automatically use either code generation or interpreted execution based on model configuration and code generation support. When using interpreted execution, the block runs via the MATLAB execution engine and does not require a compiler. For more information, see Improve Performance of Deep Learning Simulations in Simulink.

Functions

exportNetworkToSimulinkGenerate Simulink model that contains deep learning layer blocks and subsystems that correspond to deep learning layer objects (Since R2024b)

Blocks

expand all

Classify blockClassifyClassify data using a trained deep learning neural network
Predict blockPredictPredict responses using a trained deep learning neural network
Stateful Classify blockStateful ClassifyClassify data using a trained deep learning recurrent neural network
Stateful Predict blockStateful PredictPredict responses using a trained recurrent neural network
Deep Learning Object Detector blockDeep Learning Object DetectorDetect objects using trained deep learning object detector
TensorFlow Model Predict Block IconTensorFlow Model PredictPredict responses using pretrained Python TensorFlow model (Since R2024a)
PyTorch Model Predict Block IconPyTorch Model PredictPredict responses using pretrained Python PyTorch model (Since R2024a)
ONNX Model Predict Block IconONNX Model PredictPredict responses using pretrained Python ONNX model (Since R2024a)
Custom Python Model Predict Block IconCustom Python Model PredictPredict responses using pretrained custom Python model (Since R2024a)
Clipped ReLU Layer blockClipped ReLU LayerClipped Rectified Linear Unit (ReLU) layer (Since R2024b)
GELU Layer blockGELU LayerGaussian error linear unit (GELU) layer (Since R2024b)
Leaky ReLU Layer blockLeaky ReLU LayerLeaky rectified linear unit (ReLU) layer (Since R2024b)
PReLU Layer blockPReLU LayerParameterized rectified linear unit (PReLU) layer (Since R2026a)
ReLU Layer blockReLU LayerRectified linear unit (ReLU) layer (Since R2024b)
Sigmoid Layer blockSigmoid LayerSigmoid layer (Since R2024b)
Softmax Layer blockSoftmax LayerSoftmax layer (Since R2024b)
Swish Layer blockSwish LayerSwish layer (Since R2026a)
Tanh Layer blockTanh LayerHyperbolic tangent (tanh) layer (Since R2024a)
Addition Layer blockAddition LayerAddition layer (Since R2024b)
Concatenation Layer blockConcatenation LayerConcatenation layer (Since R2024b)
Depth Concatenation Layer blockDepth Concatenation LayerDepth concatenation layer (Since R2024b)
Multiplication Layer blockMultiplication LayerMultiplication layer (Since R2024b)
Convolution 1D Layer blockConvolution 1D Layer1-D convolutional layer (Since R2024b)
Convolution 2D Layer blockConvolution 2D Layer2-D convolutional layer (Since R2024b)
Convolution 3D Layer blockConvolution 3D Layer3-D convolutional layer (Since R2024b)
Fully Connected Layer blockFully Connected LayerFully connected layer (Since R2024b)
Grouped Convolution 2D Layer blockGrouped Convolution 2D LayerGrouped 2-D convolutional layer (Since R2026b)
Rescale-Symmetric 1D blockRescale-Symmetric 1D1-D input layer with rescale-symmetric normalization (Since R2024b)
Rescale-Symmetric 2D blockRescale-Symmetric 2D2-D input layer with rescale-symmetric normalization (Since R2024b)
Rescale-Symmetric 3D blockRescale-Symmetric 3D3-D input layer with rescale-symmetric normalization (Since R2024b)
Rescale-Zero-One 1D blockRescale-Zero-One 1D1-D input layer with rescale-zero-one normalization (Since R2024b)
Rescale-Zero-One 2D blockRescale-Zero-One 2D2-D input layer with rescale-zero-one normalization (Since R2024b)
Rescale-Zero-One 3D blockRescale-Zero-One 3D3-D input layer with rescale-zero-one normalization (Since R2024b)
Zerocenter 1D blockZerocenter 1D1-D input layer with zerocenter normalization (Since R2024b)
Zerocenter 2D blockZerocenter 2D2-D input layer with zerocenter normalization (Since R2024b)
Zerocenter 3D blockZerocenter 3D3-D input layer with zerocenter normalization (Since R2024b)
Zscore 1D blockZscore 1D1-D input layer with zscore normalization (Since R2024b)
Zscore 2D blockZscore 2D2-D input layer with zscore normalization (Since R2024b)
Zscore 3D blockZscore 3D3-D input layer with zscore normalization (Since R2024b)
Batch Normalization Layer blockBatch Normalization LayerBatch normalization layer (Since R2024b)
Instance Normalization Layer blockInstance Normalization LayerInstance normalization layer (Since R2026a)
Layer Normalization Layer blockLayer Normalization LayerLayer normalization layer (Since R2024b)
Inverse Zerocenter blockInverse ZerocenterInverse zero-center normalization (Since R2026a)
Inverse Zscore blockInverse ZscoreInverse Z-score normalization (Since R2026a)
Inverse Rescale-Zero-One blockInverse Rescale-Zero-OneInverse rescale-zero-one normalization (Since R2026b)
Inverse Rescale-Symmetric blockInverse Rescale-SymmetricInverse rescale-symmetric normalization (Since R2026b)
Average Pooling 1D Layer blockAverage Pooling 1D Layer1-D average pooling layer (Since R2024b)
Average Pooling 2D Layer blockAverage Pooling 2D Layer2-D average pooling layer (Since R2024b)
Average Pooling 3D Layer blockAverage Pooling 3D Layer3-D average pooling layer (Since R2024b)
Global Average Pooling 1D Layer blockGlobal Average Pooling 1D Layer1-D global average pooling layer (Since R2024b)
Global Average Pooling 2D Layer blockGlobal Average Pooling 2D Layer2-D global average pooling layer (Since R2024b)
Global Average Pooling 3D Layer blockGlobal Average Pooling 3D Layer3-D global average pooling layer (Since R2024b)
Global Max Pooling 1D Layer blockGlobal Max Pooling 1D Layer1-D global max pooling layer (Since R2024b)
Global Max Pooling 2D Layer blockGlobal Max Pooling 2D Layer2-D global max pooling layer (Since R2024b)
Global Max Pooling 3D Layer blockGlobal Max Pooling 3D Layer3-D global max pooling layer (Since R2024b)
Max Pooling 1D Layer blockMax Pooling 1D Layer1-D max pooling layer (Since R2024b)
Max Pooling 2D Layer blockMax Pooling 2D Layer2-D max pooling layer (Since R2024b)
Max Pooling 3D Layer blockMax Pooling 3D Layer3-D max pooling layer (Since R2024b)
Flatten Layer blockFlatten LayerFlatten layer (Since R2024b)
GRU Layer blockGRU LayerGated recurrent unit (GRU) layer for recurrent neural network (RNN) (Since R2025a)
GRU Projected Layer blockGRU Projected LayerGated recurrent unit (GRU) projected layer for recurrent neural network (RNN) (Since R2025a)
LSTM Layer blockLSTM LayerLong short-term memory (LSTM) layer for recurrent neural network (RNN) (Since R2024b)
LSTM Projected Layer blockLSTM Projected LayerLong short-term memory (LSTM) projected layer for recurrent neural network (RNN) (Since R2024b)
Dropout Layer blockDropout LayerDropout layer (Since R2024b)
Identity Layer blockIdentity LayerIdentity layer (Since R2026a)
Permute Layer blockPermute LayerPermute layer (Since R2026b)
Reshape Layer blockReshape LayerReshape layer (Since R2026b)
Scaling Layer blockScaling LayerScaling layer (Since R2026a)
Spatial Dropout Layer blockSpatial Dropout LayerSpatial dropout layer (Since R2026a)

Topics

Deep Learning Layer Blocks

Images

Sequences

Reinforcement Learning

Python Coexecution

Code Generation

Featured Examples