Using 'OR' operator with 'case' statement

54 次查看(过去 30 天)
Is it good programming practice to use 'OR' operator with 'case' statement. I want to associate multiple values of 'switch' statement with each 'case' statement like below.
switch value
case 1|2|3
execute this
case 4|5|6
execute this
end

采纳的回答

Kevin Phung
Kevin Phung 2019-1-29
This would be the proper way for using or:
switch value
case {1,2,3}
% execute this
case {4,5,6}
% execute this
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Automated Driving Toolbox 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by