MATLAB Function Block Constraint | FATAL / Nonfatal | Compatibility Check |
---|---|---|
Block names:
| Nonfatal | Check usage of MATLAB Function Blocks > Check for block names that contain ‘/*’,’*/’, or start or end with the character ‘*’ |
Output signal storage class must be set to Auto when
the block has constant (Inf ) sample time. | Nonfatal | Check usage of MATLAB Function Blocks > Check for unsupported usage of storage class |
Output port must not be testpointed when the block has constant
(Inf ) sample time. | Nonfatal | Check usage of MATLAB Function Blocks > Check for unsupported testpoints |
Output custom signal storage classes:
| Nonfatal | Check usage of MATLAB Function Blocks > Check storage class of block outports |
Input and output ports must be scalars, vectors, or 2–D matrices. | Nonfatal | Check usage of MATLAB Function Blocks > Check for blocks with greater than two-dimensional inputs or outputs |
Input and output ports must not use frame-based signals. | Nonfatal | Check usage of MATLAB Function Blocks > Check whether inputs and outputs are not framed |
MATLAB® function must set Update method to Inherited . | Nonfatal | Check usage of MATLAB Function Blocks > Check that all MATLAB functions set ‘Update method’ to ‘Inherited’ |
Function packaging (RTWSystemCode ) must be set to
Inline . If Nonreusable
function or Reusable function is
selected, the subsystem and model must be in supported
configurations. | Nonfatal | Check usage of MATLAB Function Blocks > Identify Subsystems that have unsupported configurations for non-inlined |
The reusable subsystem in a model must be from a library. It must be unmasked, single-rate atomic or function-call subsystem. | Nonfatal | Check usage of MATLAB Function Blocks > Check that reusable subsystems in a model are from a library and are unmasked single-rate atomic or function-call subsystems |
MATLAB function must not use input Trigger signals. | Nonfatal | Check usage of MATLAB Function Blocks > Check that MATLAB functions do not contain input Trigger signals |
Block that is constant or has parameters that can be tuned must not drive two or more multirate blocks without using explicit Rate Transition blocks. | Nonfatal | Check usage of MATLAB Function Blocks > Check that blocks that are constant or whose parameters can be tuned, do not drive two or more multirate blocks without using explicit rate transition blocks |
Saturate on integer overflow (SaturateOnIntegerOverflow )
must not be selected (must be set to off ). | Nonfatal | Check usage of MATLAB Function Blocks > Check that all MATLAB functions set ‘Saturate on integer overflow’ to ‘Off’ |
Treat these inherited Simulink signal types as fi
objects must not be set to Fixed-point &
Integer . | Nonfatal | Check usage of MATLAB Function Blocks > Check that all MATLAB functions set ‘Treat these inherited Simulink signal types as fi objects:’ to a value other than ‘Fixed-point & Integer’ |
Support variable-size arrays must not
be selected (must be set to off ). | FATAL | Check usage of MATLAB Function Blocks > Check that all MATLAB functions set ‘Support variable-size arrays’ to ‘Off’ |
MATLAB Function Data Constraint | FATAL / Nonfatal | Compatibility Check |
---|---|---|
Data defined in a MATLAB function must be of one of the following supported data
types: built-in, bus, or an enumerated type inherited from
Simulink.IntEnumType . | Nonfatal | Check usage of Data in MATLAB Functions > Check that data defined in MATLAB function is of a supported data type |
Data defined in a MATLAB function must be of one of the following supported dimensions: scalar, vector, or matrix. | Nonfatal | Check usage of Data in MATLAB Functions > Check that data defined in MATLAB function is of a supported dimension |
Data defined in a MATLAB function must be noncomplex. | Nonfatal | Check usage of Data in MATLAB Functions > Check that data defined in MATLAB function is non-complex |
MATLAB Code Constraint | FATAL / Nonfatal | Compatibility Check |
---|---|---|
To use non-inlined user-defined functions with global variables in MATLAB code:
| Nonfatal | Check usage of Code in MATLAB Functions > Check non-inlined user defined functions with global variables in MATLAB code |
Non-inlined user-defined functions in MATLAB code must define only one output | Nonfatal | Check usage of Code in MATLAB Functions > Check that non-inlined user defined functions in MATLAB code contain only one output |
Array subscripting in MATLAB code must use a constant index value of 1 for a corresponding dimension of size 1. | Nonfatal | Check usage of Code in MATLAB Functions > Check that array subscripting in MATLAB code uses a constant index of 1 for a corresponding dimension of size 1 |
Array indexing in MATLAB code must use a subscript that is less than or equal to the array base dimension. | Nonfatal | Check usage of Code in MATLAB Functions > Check that array indexing in MATLAB code uses a subscript that is less than or equal to the array base dimension |
| Nonfatal | Check usage of Code in MATLAB Functions > Check type argument for cast in MATLAB functions |
colon (: ) operator
must not have more than 3 operands. | Nonfatal | Check usage of Code in MATLAB Functions > Check that colon operators in MATLAB code have no more than 3 operands |
colon (: ) operator
must use integer or double data. | Nonfatal | Check usage of Code in MATLAB Functions > Check that colon operators in MATLAB code use only integer and double data |
Data used in a MATLAB function must be of one of the following
data types: boolean , int8 , int16 , int32 , uint8 , uint16 , uint32 , single , double ,
or scalar bus. | Nonfatal | Check usage of Code in MATLAB Functions > Check that data used in MATLAB function is of a supported data type |
A diagonal number specified for the D = diag(v,k) where | Nonfatal | Check usage of Code in MATLAB Functions > Check that diagonal number used in a diag function in MATLAB code is constant |
Identifiers used in assignment, array, function call arguments and function definition arguments must be scalar, vector, or matrix. Identifiers used in any other context must be scalar. | Nonfatal | Check usage of Code in MATLAB Functions > Check that code in MATLAB function is of a supported dimension |
Brackets in MATLAB code must not be empty. | Nonfatal | Check usage of Code in MATLAB Functions > Check for nonempty brackets in MATLAB code |
for statements in MATLAB code must
have index ranges that are mono incremental colon expressions. | Nonfatal | Check usage of Code in MATLAB Functions > Check that for statements in MATLAB code have index ranges that are mono incremental colon expressions |
for statements in MATLAB code must
have index range values that are literal const integers. | Nonfatal | Check usage of Code in MATLAB Functions > Check that for statements in MATLAB code have index range values that are literal const integers |
for statements in MATLAB code must
have scalar index values. | Nonfatal | Check usage of Code in MATLAB Functions > Check that for statements in MATLAB code have scalar index values |
Operands of the dot power operator must be of single or double data type. | Nonfatal | Check usage of Code in MATLAB Functions > Check that data defined in MATLAB function is of a double or single data type |
For MATLAB root functions, if For user-defined MATLAB functions, the | Nonfatal | Check usage of Code in MATLAB Functions > For MATLAB root function, do not specify coder.inline directive or set coder.inline directive to 'always'. For user defined MATLAB functions, explicitly set coder.inline directive to 'always' or 'never' |
Math functions in MATLAB code must use integer or floating-point data. | Nonfatal | Check usage of Code in MATLAB Functions > Check that math functions in MATLAB code use only integer and floating-point data |
MATLAB functions must not have missing data type information. | Nonfatal | Check usage of Code in MATLAB Functions > Check that no code in MATLAB functions has missing data type information |
MATLAB functions must not have missing dimension information. | Nonfatal | Check usage of Code in MATLAB Functions > Check that no code in MATLAB functions has missing dimension information |
Function calls in MATLAB code must resolve to a known function definition. | Nonfatal | Check usage of Code in MATLAB Functions > Check that all function calls in MATLAB code resolve to a known function definition |
Operators in MATLAB functions must not have operands with mixed data type. | Nonfatal | Check usage of Code in MATLAB Functions > Check that operators used in MATLAB function do not have operands with mixed data type |
When using matrix operations in MATLAB code, the Loop unrolling threshold must not result in partially unrolled loops in the generated code. | Nonfatal | Check usage of Code in MATLAB Functions > Check that the ‘Loop unrolling threshold’ does not result in partially unrolled loops in the generated code when using matrix operations in MATLAB code |
Conditional initialization of a persistent variable must use
an if statement with a single isempty(persistent) or ~isempty(persistent) condition. | Nonfatal | Check usage of Code in MATLAB Functions > Check that conditional initialization of persistent variables uses an 'if' statement with a single isempty(persistent) or ~isempty(persistent) condition |
Conditional initialization of a persistent variable must contain
only one statement in if statement body. | Nonfatal | Check usage of Code in MATLAB Functions > Check that there is only one initialization statement of a persistent variable in ‘if’ statement body |
switch statements must not have case expressions
containing a cell array. | Nonfatal | Check usage of Code in MATLAB Functions > Check that switch statements in MATLAB code do not have case expressions containing a cell array |
switch statements must use the same scalar
integer type for all switch and
case conditions. | Nonfatal | Check usage of Code in MATLAB Functions > Check that switch statements in MATLAB code use the same scalar integer type for all conditions |
The colon (: ) function and division operations in
MATLAB code must use scalar operands. | Nonfatal | Check usage of Code in MATLAB Functions > Check that operators and functions in MATLAB code have supported operand dimensions |
if statements must use conditions that are
scalar. | Nonfatal | Check usage of Code in MATLAB Functions > Check that if statements in MATLAB code use conditions that are scalar |
MATLAB functions must not contain unsupported MATLAB code. | Nonfatal | Check usage of Code in MATLAB Functions > Check for unsupported MATLAB code in MATLAB functions |
Model must not define recursive functions in MATLAB code. | Nonfatal | Check usage of Code in MATLAB Functions > Check usage of recursive functions in MATLAB code |
coder.ceval must not specify the
-global option. | Nonfatal | Check usage of Code in MATLAB Functions > Check that coder.ceval in MATLAB code does not specify '-global' option |
coder.ceval must not specify the
layout option. | Nonfatal | Check usage of Code in MATLAB Functions > Check that coder.ceval in MATLAB code does not specify layout option |
Subfunctions in MATLAB code must not call function call outputs. | Nonfatal | Check usage of Code in MATLAB Functions > Check usage of function call outputs in MATLAB code |
MATLAB code must not contain the definition of inner function. | Nonfatal | Check usage of Code in MATLAB Functions > Check usage of inner functions in MATLAB code |
MATLAB Code Analyzer Message Constraint | FATAL / Nonfatal | Compatibility Check |
---|---|---|
Issues in MATLAB Function block. | Nonfatal | Check MATLAB Code Analyzer messages > Check MATLAB code used in MATLAB Function blocks |
Issues in called MATLAB functions. | Nonfatal | Check MATLAB Code Analyzer messages > Check called MATLAB functions |