Main Content

Preserve condition expression in if statement

Preserve empty primary conditions in if statements

Model Configuration Pane: Code Generation / Code Style

Description

Specify whether to preserve empty primary condition expressions in if statements.

Settings

off (default) | on

Default: off

On

Preserves empty primary condition expressions in if statements, such as the following, to increase the readability of the code or for code traceability purposes.

Off

Optimizes empty primary condition expressions in if statements by negating them.

Examples

expand all

Compare the if statements in the generated code when you set Preserve condition expression in if statement to different values.

Here is generated code that generated using the default Preserve condition expression in if statement value off:

if expression1
else
       statements2;
end

Here is the same code generated with Preserve condition expression in if statement set to on:

if ~expression1
        statements2;
end

Recommended Settings

ApplicationSetting
DebuggingOn
TraceabilityOn
EfficiencyOff (execution, ROM), No impact (RAM)
Safety precaution

No recommendation

Programmatic Use

Parameter: PreserveIfCondition
Type: character vector
Value: 'on' | 'off'
Default: 'off'

Version History

Introduced in R2007a