Question regarding a switch statement

조회 수: 13 (최근 30일)
George Drakopoulos
George Drakopoulos 2013년 12월 16일
답변: Michael Dimitroulopoulos 2013년 12월 16일
Can I have multiple types of arguments in a switch statement? Eg
switch n
case 'abc'
% do something
case 4
% do something else
otherwise
end

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 16일
Example
n=input('n=');
switch n
case 'abc'
out=1
case 4
out=2
otherwise
out=3
end

추가 답변 (1개)

Michael Dimitroulopoulos
Michael Dimitroulopoulos 2013년 12월 16일

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by