Main Content

Large constant threshold in MATLAB functions (bytes)

Threshold above which the code generator writes DNN constants to binary data files

Since R2024a

Model Configuration Pane: Code Generation


The Large constant threshold in MATLAB functions (bytes) parameter specifies the threshold (in bytes) above which the constants for a deep neural network (DNN) are written to binary data files.

This parameter is applicable only if you generate code that does not depend on third-party deep learning libraries.


To enable this parameter, perform both these actions:

  • Enable Dynamic memory allocation in MATLAB functions

  • Set Large constant generation in MATLAB functions to Write only deep learning constants to data files


131072 (default) | integer

The code generator by default sets this parameter to 131072 bytes. Depending on your application, you can set this threshold to a different integer value.

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyDepends on your application
Safety precautionNo impact

Programmatic Use

Parameter: LargeConstantThreshold
Type: integer
Values: threshold in bytes
Default: 131072

Version History

Introduced in R2024a