To give the option of restarting the code in MATLAB you can use a loop structure. Here is an example:
main.m174 chars9 lines
The while
loop will continue executing until the user enters 'N' or any other input that is not 'Y'. The input
function is used to prompt the user for input, and the 's'
argument specifies that it should be read as a string. The upper
function is used to convert the input to uppercase so that both 'Y' and 'y' will be accepted.
gistlibby LogSnag