Main Content

Loop Unrolling Threshold

Specify minimum array size width for generating for loops

Model Configuration Pane: PLC Code Generation / Optimization


The Loop unrolling threshold parameter specifies the minimum signal or parameter width for which a for loop is generated.


5 (default)

Specify the array size at which the code generator begins to use a for loop instead of separate assignment statements to assign values to the elements of a signal or parameter array.

When the loops are perfectly nested loops, the code generator uses a for loop if the product of the loop counts for all loops in the perfect loop nest is greater than or equal to this threshold.

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyLess than five
Safety precautionNo impact

Programmatic Use

Parameter: PLC_RollThreshold
Type: string
Value: any valid value
Default: '5'

Version History

Introduced in R2012b