Creating a Yes/No option for my program
显示 更早的评论
I have a program that has 3 options with the fourth option being the exit program option. It then asks the user if they are sure, if the user hits yes it leaves a farewell message. If the user hits no, it should restart the program. How can I edit my code so that is the user picks no, it will rerun the entire program?

回答(1 个)
KSSV
2020-5-6
Use strcmp to compare two strings.
strcmp(choice,'yes')
Also read about strcmpi.
类别
在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!