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
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. For a list of supported layer objects and unsupported property values, see List of Deep Learning Layer Blocks and Subsystems.
If the input network contains a layer object that does not have a corresponding layer block, 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. 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, the function either throws an error or substitutes a different value. For specific behaviors, see List of Deep Learning Layer Blocks and Subsystems or each layer block reference page. To change the value of a layer object property to a supported value, use the Deep Network Designer app.
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.For networks that contain
ProjectedLayerobjects, use theunpackProjectedLayersfunction.For networks that contain
networkLayerobjects, use theexpandLayersfunction.