mathworks.maab.na_0022: What kind of Parameters can I use as constant values for Case arguments in Matlab function blocks?
2 views (last 30 days)
Show older comments
Hello All,
According to "
na_0022: Recommended patterns for Switch/Case statements
" rule, parameters and enumerations can be used as constant values for case statements:
functionoutVar = NA_0022_Pass(SwitchVar)
%#codegen
switchSwitchVar
caseCase_1_Parameter% Parameter
outVar = 0;
caseNA_0022.Case_2% Enumerated Data Type
outVar = 2;
otherwise
outVar = 10;
end
end
What kind of Parameter is mentioned in this example? Is it a Simulink.Parameter? If yes, how should I declare it?
My first thought was, that 'Case_1_Parameter' is a masked parameter, but if Matlab function blocks are masked, parameter arguments shall appear in the function header, and in the example above there is no such an argument. I also tried to add Simulink.Parameter objects to the model and base workspaces, the model could not compile saying "Undefined function or variable 'Case_1_Parameter".
Thank you.
--
Best Regards, Evgeny
0 Comments
Answers (0)
See Also
Categories
美军陆军nity Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!