NA-MAAB — a
JMAAB — Not supported
All
Switch
/Case
statements shall use constant
values for Case
arguments.
Input variables shall not be used in Case
arguments.
Not Applicable
function outVar = NA_0022_Pass(SwitchVar) %#codegen switch SwitchVar case Case_1_Parameter % Parameter outVar = 0; case NA_0022.Case_2 % Enumerated Data Type outVar = 2; otherwise outVar = 10; end end
function outVar = NA_0022_Fail(Case_1,Case_2,Case_3,SwitchVar) %#codegen switch SwitchVar case Case_1 outVar = 1; case Case_2 outVar = 2; case Case_3 outVar = 3; otherwise outVar = 10; end end
Sub ID a:
Improves model simulation and testability.
Code generation may not be possible.
Model Advisor check: Check usage of recommended patterns for Switch/Case statements (Simulink Check)
R2020a