Main Content

Preserve condition expression in if statement

Description

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

Category: Code Generation > Code Style

Settings

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.

if expression1
else
       statements2;
end
Off

Optimizes empty primary condition expressions in if statements by negating them. For example, consider the following if statement:

if expression1
else
       statements2;
end

By default, the code generator negates this statement as follows:

if ~expression1
        statements2;
end

Command-Line Information

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

Recommended Settings

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

No recommendation

Related Topics