exportNetworkToSimulink
Generate Simulink model that contains deep learning layer blocks and subsystems that correspond to deep learning layer objects
Since R2024b
Description
creates a Simulink® model for a trained mdlInfo = exportNetworkToSimulink(net)dlnetwork object, net.
The model uses a fixed-step solver and contains deep learning layer blocks and subsystems
that correspond to layers in the network. The function returns a structure that contains
information about the generated model.
For a list of deep learning layer blocks and subsystems, see List of Deep Learning Layer Blocks and Subsystems. If the network contains a layer that does not have a corresponding deep learning layer block or subsystem, then the function generates a placeholder subsystem that contains an Assertion (Simulink) block. You can manually replace the Assertion block with an implementation of the layer.
Input Arguments
Name-Value Arguments
Output Arguments
Limitations
Before R2026a: The
exportNetworkToSimulinkfunction supports only networks that have one input and one output (networks where theInputNamesandOutputNamesproperties are scalar).Because deep learning layer blocks and subsystems do not support the batch (
B) dimension, theexportNetworkToSimulinkfunction ignores batch dimensions in layer objects and produces models that assume only one observation.The function supports only a limited set of layer objects and does not support certain property values for certain layer objects.
If the input network contains a layer object that does not have a corresponding layer block or subsystem, then the function generates a placeholder subsystem for you to replace with your own implementation of the layer. For more information, see Implement Unsupported Deep Learning Layer Blocks.
If the input network contains a layer object that has a corresponding layer block but the object uses a property value that the block does not support, then the function either generates a placeholder subsystem (since R2026a), substitutes a different value, or throws an error.
Before R2026a: The function throws an error for some networks with unsupported property values.
For more information on supported layer objects, supported property values, and specific behaviors, see List of Deep Learning Layer Blocks and Subsystems.
Tips
Because the generated model references the input network, you can update the weights that the model uses by retraining the network without re-exporting to Simulink.
To export a
SeriesNetworkorDAGNetworkobject to Simulink, use thedag2dlnetworkfunction to convert the object to adlnetworkobject and pass that converted object to theexportNetworkToSimulinkfunction.Before R2026a: For networks that contain
ProjectedLayerobjects, use theunpackProjectedLayersfunction.Before R2026a: For networks that contain
networkLayerobjects, use theexpandLayersfunction.