Main Content

MATLAB Function and MATLAB Code Considerations

R2026b
MATLAB Functions, MATLAB® code

Apply high-integrity guidelines for MATLAB Functions and MATLAB code.

Modeling Guidelines

expand all

himl_0001: Usage of standardized MATLAB function headersUse a standardized header to document the purpose and use of MATLAB functions
himl_0003: Complexity of user-defined MATLAB FunctionsLimit the size and complexity of MATLAB function code
himl_0002: Strong data typing at MATLAB function boundariesExplicitly define the complexity and type of input signals, output signals, and parameters at MATLAB function interfaces
himl_0004: MATLAB Code Analyzer recommendations for code generationUse MATLAB Code Analyzer with %#codegen directive and follow code generation recommendations
himl_0006: MATLAB code if / elseif / else patternsTerminate if/elseif/else constructs with an else statement containing meaningful comment
himl_0007: MATLAB code switch / case / otherwise patternsInclude at least two case statements and an otherwise statement with a meaningful comment in switch constructs
himl_0008: MATLAB code relational operator data typesUse the same data type for left and right operands of relational operators
himl_0010: MATLAB code with logical operators and functionsUse logical data types for logical operators and logical functions
himl_0011: Data type and size of condition expressionsUse logical scalars for condition expressions
himl_0012: Usage of MATLAB functions for code generationRestrict MATLAB code to functions supported by code generation
himl_0013: Limitation of built-in MATLAB Function complexityLimit built-in MATLAB function usage that may produce overly complex generated code