有人在Matlab中关闭GUI时发出警告消息

有人在Matlab中关闭GUI时发出警告消息,matlab,user-interface,warnings,message,Matlab,User Interface,Warnings,Message,当用户关闭GUI(使用rght top“x”)时,如何在GUI Matlab中生成警告消息。例如,您可以询问用户是否确实要关闭图形。为此,可以使用内置模式窗口,如。上述文件中给出了一个示例: function my_closereq(src,evnt) % User-defined close request function % to display a question dialog box selection = questdlg('Close This Figure?',...

当用户关闭GUI(使用rght top“x”)时,如何在GUI Matlab中生成警告消息。

例如,您可以询问用户是否确实要关闭图形。为此,可以使用内置模式窗口,如。上述文件中给出了一个示例:

function my_closereq(src,evnt)
% User-defined close request function
% to display a question dialog box
   selection = questdlg('Close This Figure?',...
                        'Close Request Function',...
                        'Yes','No','Yes');
   switch selection,
      case 'Yes',
         delete(gcf)
      case 'No'
         return 
   end
end

这篇文章的可能副本肯定不是引用文章的副本。