After running a script i got answer in command window, now how can i run it again from command window?

2 views (last 30 days)
I want to write a program so that after running it give desired output of some algorithm and display result in command window. and then ask **'do you want to run again Y/N'****. if i select Y it execute the program again. and if 'N' is selected it will not do any thing.
how i solve this because in C-programming we have do-while loop which i find easy. But here i can't find such.
plz help with code. and sufficient description.

Accepted Answer

Image Analyst
Image Analyst on 4 Mar 2013
Here's one way:
button = 'Continue';
while strcmpi(button, 'Continue')
promptMessage = sprintf('Do you want to Continue processing,\nor Cancel to abort processing?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
break;
end
end

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!