vendredi 19 juin 2015

How to keep iterating through loops in MATLAB

I have my matlab code

usrinput = input('Enter Month: ', 's');
if strcmp(usrinput, 'July')
    disp('Summer')
elseif strcmp(usrinput, 'January')
      disp('Winter')
elseif strcmp(usrinput,'October')
disp('Fall')
elseif strcmp(usrinput, 'April')
disp('Spring')
end

Where you input a month and it gives you the season, But every time I call the script (called month) and input a month in I have to call the script again to do another month. How can I set it so that I don't have to call the script every time. AKA after I type in July and it says Winter, it will automatically say "Enter Month:" again and I can type in a new month Thanks!

Aucun commentaire:

Enregistrer un commentaire