Main Content

himl_0013: Limitation of built-in MATLAB function complexity

R2026b

Limit built-in MATLAB function usage that may produce overly complex generated code

Usage: High-Integrity System Modeling

Guideline ID: himl_0013

Rules

himl_0013: Limitation of built-in MATLAB function complexity

When authoring MATLAB code, limit the usage of built-in MATLAB functions that may result in generated code that exceeds complexity limits established for your project.

Rationale

Improve testability and maintainability.

Verification

Metrics for generated code complexity (Simulink Check)

Tips

  • Complexity limits can vary across projects. Typical limits might be as described in this table:

    MetricLimit
    Cyclomatic Complexity (Generated Code)40

Industry Standards

  • ISO 26262-6, Table 1 (1a) - Enforcement of low complexity

  • ISO 26262-6, Table 1 (1b) - 'Use of language subsets'

  • ISO 26262-6, Table 3 (1b) – 'Restricted size and complexity of software components'

Version History

Introduced in R2021b