Restart code or exit matlab

Is there any way I can prompt the user to choose whether to restart the code or to exit Matlab.
The part where I need this code to work is after I print out the result using the switch case.

3 个评论

Mahi
Mahi 2018-11-25
编辑:Mahi 2018-11-25
Hi,
When you say code, does it mean a loop/function?
Thanks...
my program actually consist of a while loop and switch case. the switch case is placed after i ended the while loop
I have already answered it. If it is correct then please upvote the answer.

请先登录,再进行评论。

回答(2 个)

Mahi
Mahi 2018-11-25

1 个投票

If CODE here stands for a loop then please refer to the following link:
More infromation can be found here:
Hope this helps!
Thanks..
while true
inner loop stuff goes here
switch expression
case 'restart'
continue %while true loop
case 'terminate'
quit
end
end

类别

帮助中心File 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