title: How can I trap the user in inputdlg()
body: <p>Here is my program.</p>
  
  <pre><code>clc
  clear
  ques='Yes';
  while strcmp(ques,'Yes')
  ns={'One','Two','Three','Four','Five'};
  [selection ok]= listdlg('liststring',ns,'selectionmode','single');
  while ok ==0
      msgbox('Please make a selection')
      [selection ok]= listdlg('liststring',ns,'selectionmode','single');
  end
  gradebook = {};
  for d=1:selection
  sinfo ={'Enter student name','Numerical grade for 1st exam (out of 100):','Numerical grade for 2nd exam (out of 100):','Numerical grade for 3rd exam (out of 100):'};
  info=inputdlg(sinfo);
  gradebook= [gradebook info];
  end
  for d=1:selection
      average(d)=mean(str2double(gradebook(2:end,d)));
  end
  [value where]=max(average);
  name=gradebook {1,where};
  msg=sprintf('%s has the highest average. Average grade is %.2f%%',name,value);
  ok2=msgbox(msg);
  waitfor(ok2)
  ques=questdlg ('Do you want to repeat the program?');
  end
  </code></pre>
  
  <p>My question is How can I redisplay the inputdlg() if the user press "cancel" instead of "ok"?</p>
  
  <p>Thank you very much! :)</p>