Using cases with strings
古いコメントを表示
Hi, Im trying to make the following code work and it just wont seem to do what I want
Astr = '123456789'
switch Astr
case strcmp(Astr([2:4,5:7]), '234567' )
x = 5
case strcmp(Astr([2:4,5:7]), '123567' )
x = 6
case strcmp(Astr([2:4,5:7]), '345567' )
x = 7
otherwise
x = 8
end
I think it has to do with the way Im defining the string values, it keeps outputting x = 8 (the otherwise case). Please let me know how to fix thanks!
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Propagation and Channel Models についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!