Switch case option valid for two cases?
显示 更早的评论
Hi, there.
Thanks in advance for any help!
I'm trying to extract P and/or S wave velocity profiles from corresponding text files. Here is what I'm trying. It doesn't seem to like that 'ps' is being called for both cases.
I know I could just copy the separate 'p' and 's' case options into a third 'ps' option, but I was hoping there was a way to not do that.
n = input('Which velocity model(s)? Enter p, s, or ps in single quotes: ');
switch n
case {'p','ps'}
% code to extract P velocity from P velocity text file
case {'s','ps'}
% code to extract S velocity from S velocity text file
otherwise
warning('Invalid choice')
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!