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

sclab

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.

Best Answer

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