How to apply validation on matlab M-file?

조회 수: 2 (최근 30일)
researcher
researcher 2011년 4월 29일
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!

채택된 답변

Kaustubha Govind
Kaustubha Govind 2011년 4월 29일
Looks like you have your call to warndlg after "close(gcbf)". Try putting it above that.
  댓글 수: 1
Walter Roberson
Walter Roberson 2011년 4월 29일
And use questiondlg() instead of warndlg(), as warndlg() does not give the user any way to chose between closing or not.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by