Main Content

Array container type

Container type for arrays

Since R2020a

Model Configuration Pane: Code Generation / Code Style


Specify the container type for arrays in the generated code. Choose either C-style array or std::array.


To enable this parameter, set Language to C++ and set Code interface packaging to C++ class.


C-style array (default) | std::array

Default: C-style array

C-style array

The code generator generates array containers by using C-style arrays.


std::array is a template class that represents fixed-size arrays. If you choose this option, the code generator generates array containers by using std::array.


expand all

Compare the array container types in the generated code when you set Array container type to different values.

Here is generated code that generated using the default Array container type value C-style array:

real_T const_val[4] = { 1.0, 2.0, 3.0, 4.0 } ;

Here is the same code generated with Array container type set to std::array:

std::array<real_T, 4> const_val = { { 1.0, 2.0, 3.0, 4.0 } };

Recommended Settings

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo recommendation

Programmatic Use

Parameter: ArrayContainerType
Type: character vector
Value: 'C-style array' |'std::array'
Default: 'C-style array'

Version History

Introduced in R2020a