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
Chunru 2021 年 5 月 7 日

0 投票

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 件)

カテゴリ

ヘルプ センター および File ExchangeAuthor Block Masks についてさらに検索

タグ

質問済み:

2021 年 5 月 6 日

コメント済み:

2023 年 10 月 18 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by