Code Style
You can configure the code generator to follow style rules to make code more readable and consistent. The code generator can remove or include optional syntactical features such as parentheses and unreachable statements.
You can configure the code generator to implement certain operations in ways that prioritize performance or readability. For example, when multiplying by a power of two, it is more efficient but less readable to use a signed bitwise shift rather than the multiplication operator. You can configure the code generator to prefer either method.
Topics
- Enhance Readability of Code for Flow Charts
Describes how to convert if-elseif-else code to switch-case statements to enhance readability of generated code.
- Enhance Code Readability for MATLAB Function Blocks
Convert if-elseif-else code to switch-case statements.
- Improve Data Coherency in Generated Code
Generate a single unique variable for each Data Store read and write operation and thereby enhance Data Coherency.
- Control Parentheses in Generated Code
Specify how parentheses are placed in the code.
- Optimize Code by Reordering Commutable Operands
Reorder the execution of operands in the generated code to improve efficiency.
- Suppress Generation of Default Cases for Unreachable Stateflow Switch Statements
Specify if a default case is generated among switch-case statements.
- Replace Multiplication by Powers of Two with Signed Bitwise Shifts
Specify whether to replaces multiplication by powers of two with signed bitwise shifts.
- Generate Code Containing Right Shifts on Signed Integers
Specify whether the generated code contains right shifts on signed integers.
- Control Cast Expressions in Generated Code
Control the data type casts that the code generator specifies in the generated code.