Main script: Choose between multiple functions

조회 수: 17 (최근 30일)
Kasper Jørgensen
Kasper Jørgensen 2015년 4월 7일
댓글: Kasper Jørgensen 2015년 4월 7일
Hello
I am currently working on a main script that includes multiple functions (4 functions). I am trying to work out how i can tell a user to pick one of those functions and execute it.
The first functions HAS to be executed, before any of the other functions can be used.
The mainscript needs to be able to go back and use the same functions, or any of the other functions after it has been executed.
Is it possible to use a while command in this case? or am i completely wrong?
Thanks in advance :)
Sincerely Kasper

채택된 답변

TAB
TAB 2015년 4월 7일
function MyMainFcn()
while(1)
FcnSel= uint8(input('Which function to run-->'));
switch FcnSel
case 1
MyFcn1();
case 2
MyFcn1();
otherwise
break;
end
end
end
  댓글 수: 1
Kasper Jørgensen
Kasper Jørgensen 2015년 4월 7일
Thanks for the quick answer, it seems to work quite good!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by