exportNetworkToSimulink
Generate Simulink model that contains deep learning layer blocks 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 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, see List of Deep Learning Layer Blocks. If the network contains a layer that does not have a corresponding deep learning layer block, the function generates a placeholder subsystem that contains a Stop Simulation (Simulink) block. You can manually replace the Stop Simulation block with an implementation of the layer.
Input Arguments
Output Arguments
Limitations
The
exportNetworkToSimulink
function supports only networks that have one input and one output.Because deep learning layer blocks do not support the batch (
B
) dimension, theexportNetworkToSimulink
function 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.
If the input network contains a layer object that does not have a corresponding layer block, the function generates a placeholder subsystem that contains a Stop Simulation (Simulink) block. You can manually replace the Stop Simulation 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 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
SeriesNetwork
orDAGNetwork
object to Simulink, use thedag2dlnetwork
function to convert the object to adlnetwork
object and pass that converted object to theexportNetworkToSimulink
function.For networks that contain
ProjectedLayer
objects, use theunpackProjectedLayers
function.For networks that contain
networkLayer
objects, use theexpandLayers
function.
Version History
Introduced in R2024b