choose which function to run it
5 ビュー (過去 30 日間)
古いコメントを表示
How can i make user choose which function that will be called
Ex: to run function 1 please enter 1
to run function 2 please enter 2 ..etc
採用された回答
Chunru
2021 年 5 月 7 日
You can use switch:
f = input('Which function to use? ');
switch f
case 1
func1;
case 2
func2;
otherwise
error('Wrong choice');
end
Of cource, you can also use if..elseif..else..end
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!