MATLAB: Multple switch expressions needed to run

casemultple switch expressionsswitch

I need some help on executing multiple cases when using the "Switch" function. An example to clearify this
scenario = {'a', 'b'}
switch scenario
case 'a'
disp('Hello ')
case 'b'
disp('World')
case 'c'
disp('dont display')
end
The output what i'm looking for word be:
'Hello '
'World'
The idea is that "Case" would check if the variable is in scenario and accordinly run it. Could anyone please give me a suggestion how I could do this elegantly? It seems this only works the other way around.
Thanks a lot!

Best Answer

As Rik Wisselink hinted:
scenario = {'a','b'};
for k = 1:numel(scenario)
switch scenario{k}
case 'a'
disp('Hello ')
case 'b'
disp('World')
case 'c'
disp('dont display')
end
end
displays:
Hello
World