A switch case with multiple results or switch expressions?
Show older comments
Is such a switch case possible? If not, whats my workaround for it?
switch r,d
case d=1 && r=1
continue
case d=1 && r>1
disp('zero')
case d=0 && r=1
disp('positive one')
case d=0 && r>1
disp('other value')
end
Accepted Answer
More Answers (1)
Walter Roberson
on 23 Dec 2020
switch true
case d==1 && r==1
continue
case d==1 && r>1
disp('zero')
case d==0 && r==1
disp('positive one')
case d==0 && r>1
disp('other value')
otherwise
disp('Uh-oh!')
end
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!