trouble with switch case
3 次查看(过去 30 天)
显示 更早的评论
I got a function which i would like to be something like this:
function output = calc(input)
switch input
case 'Static'
bla bla
case 'Dynamic'
bla bla
case 'Dynamic2'
bla bla
case 'Compined'
. . .
bla bla
end
end
Nothign special untill now.My problem is that in the case 'Compined' i would like to chouse again another case and after make the calculations.I tried to use cell array where the input would be for example {'Static'} or {'Dynamic'} or {'Dynamic2'} {'Compined','Static'} or {'Compined','Dynamic'} or {'Compined','Dynamic2'} and the code in line 2 would change to :
switch input(1)
and in the compined i to make another switch:
switch input(2)
for the second element of the cell.But cell cannot be used in switch.Any ideas how to impliment it?
Thanks in advance
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!