questdlg loop

6 visualizaciones (últimos 30 días)
Mallory
Mallory el 24 de Dic. de 2011
Hi, i'm using questdlg for asking wether the drawn polygon by user is right or wrong.for example,if i press 'Yes' then it will retrieve the coordinate position of the polygon. but if i press 'No' it will delete the drawn polygon and the user can draw a new polygon. and it will be repeated as long as the user click 'No'and will stop until user click 'Yes' and then the 'Yes' answer will give the position of the polygon.
i try using the switch command to do that. but it won't do the loop for the answer 'No'
here is the script that i wrote
axis ([0 100 0 100])
hold on
h=impoly
ButtonName = questdlg('Do you want to save the polygon?',...
'Save Polygon',...
'Yes','No','Yes');
switch ButtonName,
case 'Yes',
pos=getPosition(h)
case 'No',
delete(h)
h=impoly
ButtonName = questdlg('Do you want to save the polygon?',...
'Save Polygon',...
'Yes','No','Yes');
end
how can i create the loop for the answer 'No'? Thanks in advance!! :D

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 24 de Dic. de 2011
You need to use the while-loop to do that.
while ~isequal(ButtonName,'Yes')
%include your switch-case code here
end
  1 comentario
Mallory
Mallory el 24 de Dic. de 2011
thanks for the simple yet useful advice, worked very well for me! :D

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by