Main Content

Preserve variable names

Variable names to preserve in the generated code

Description

App Configuration Pane: Advanced

Configuration Objects: coder.MexCodeConfig | coder.CodeConfig | coder.EmbeddedCodeConfig

Specify which variable names the code generator must preserve in the generated code.

If your code uses large structures or arrays, setting this parameter to None can reduce memory usage or improve execution speed.

To improve the readability of the generated code, set this parameter to User names. Then, you can more easily trace the variables in the generated code back to the variables in your MATLAB® code.

Settings

None

The code generator does not have to preserve any variable names. It can reuse any variables that meet the requirements for variable reuse. This value is the default value.

All

Preserve all variable names. This parameter value disables variable reuse. Use this option only for testing or debugging, not for production code.

User names

The code generator preserves names that correspond to variables that you define in the MATLAB code. It does not replace your variable name with another name and does not use your name for another variable. This setting does not prevent an optimization from removing your variables from the generated code or prevent the C/C++ compiler from reusing the variables in the generated binary code.

Programmatic Use

Property: PreserveVariableNames
Values: 'None' | 'UserNames' | 'All'
Default: 'None'

Version History

Introduced in R2015a