How to apply validation on matlab M-file?

1 visualización (últimos 30 días)
researcher
researcher el 29 de Abr. de 2011
I want to put a warning message box at the click of a close button in a matlab figure.
function closed(hObject, eventdata)
close(gcbf);
warndlg('are you sure you want to close','!! Warning !!')
%clear all;
%close;clear
end
however this warning dialog box appears when the window is closed! Where should I put this messagebox exactly!

Respuesta aceptada

Kaustubha Govind
Kaustubha Govind el 29 de Abr. de 2011
Looks like you have your call to warndlg after "close(gcbf)". Try putting it above that.
  1 comentario
Walter Roberson
Walter Roberson el 29 de Abr. de 2011
And use questiondlg() instead of warndlg(), as warndlg() does not give the user any way to chose between closing or not.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings 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