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 Exchange에서 Author 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