Switch case
2 ビュー (過去 30 日間)
古いコメントを表示
Hi, I have two methods for calculate xg
The first one is t=1:0.1:10 xg=sin(t)
The second one is t=1:0.2:10 xg=sin (t)/2
I need to write 1, I have the result of the first method and if, I write 2 I have the result of the second method
Please can used the 'Switch case' in this case, if yes can you tell me how Please, i need your help thinks in advance
0 件のコメント
採用された回答
Sean de Wolski
2012 年 2 月 14 日
val = 'first';
switch val
case 'first'
xg = sin(0:0.1:10);
case 'second'
xg = sin(0:0.2:10);
otherwise
doc switch
end
1 件のコメント
Walter Roberson
2012 年 2 月 15 日
Note the code for 'second' should divide the sin() result by 2 to match the original question.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Array Geometries and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!