himl_0007: MATLAB code switch / case / otherwise patterns
R2026bInclude at least two case statements and an otherwise statement with a meaningful comment in switch constructs
Usage: High-Integrity System Modeling
Guideline ID: himl_0007
Rules
| himl_0007: MATLAB® code switch / case / otherwise patterns |
|---|
For MATLAB code with
Rationale
Verification Check switch statements in MATLAB Function blocks (Simulink Check) Example — Correct
Example — Incorrect
|
Tips
If there is only one
caseand oneotherwisestatement, consider using anif / elsestatement.
Industry Standards
IEC 61508-3, Table A.3 (3) 'Language subset'
IEC 61508-3, Table A.4 (3) 'Defensive programming'IEC 62304, 5.5.3 - Software Unit acceptance criteria
ISO 26262-6, Table 1(b) 'Use of language subsets'
ISO 26262-6, Table 1(d) 'Use of defensive implementation techniques'EN 50128, Table A.4 (11) 'Language Subset'
EN 50128, Table A.3 (1) 'Defensive Programming'EN 50657, Table A.4 (11) 'Language Subset'
EN 50657, Table A.3 (1) 'Defensive Programming'EN 50716, Table A.3 (1) 'Defensive Programming'
DO-331, Section MB.6.3.1.e 'Conformance to standards'
DO-331, Section MB.6.3.2.e 'Conformance to standards'
DO-331, Section MB.6.3.3.e 'Conformance to standards'MISRA C:2012, Rule 16.4
MISRA C:2023, Rule 16.4