MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab的有效句柄是什么? (https://www.labfans.com/bbs/showthread.php?t=26738)

poster 2019-12-14 20:46

Matlab的有效句柄是什么?
 
我是Matlab的新手。我正在学习Matlab文档。目前,我正在执行示例[URL="http://www.mathworks.com/help/techdoc/creating_guis/f6-8865.html"]“用于设置Simulink模型参数的GUI”[/URL] 。在上述提到的“关闭GUI”部分中,出现了“ Close按钮回调的以下代码:

function CloseButton_Callback(hObject, eventdata, handles) % Close the GUI and any plot window that is open if isfield(handles,'PlotFigure') && ... ishandle(handles.PlotFigure), close(handles.PlotFigure); end close(handles.F14ControllerEditor); 我试图通过解析句柄handles.PlotFigure的行为来了解有效的句柄。我在上面的代码的第4行中插入了一个断点,并且已经在调试模式下运行了该程序。这样做之后,我的结论是:
-有效的句柄(在本例中为称为handles.PlotFigure的Handle Graphics Object)是尚未被某些命令删除(关闭)的对象。

但是,我不明白为什么句柄字段handles.PlotFigure仍保留在handles结构中,并且尚未删除。我在调试时发现的另一个惊喜是,变量编辑器说“句柄没有有效的图。PlotFigure{1,1}”。我不明白这一点,因为handles.PlotFigure的图确实存在。

如果有人运行该示例并可以向我解释我的疑问,我将不胜感激。



[B]回答:[/B]

有关手柄的信息,请尝试以下来自Mathworks的短片:

[URL]http://blogs.mathworks.com/videos/2008/04/17/advanced-matlab-handles-and-other-inputs-to-guide-callbacks/[/URL]



[url=https://stackoverflow.com/questions/5465507]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:21

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.