MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何解决hgload中的Matlab递归RecursionDetected错误? (https://www.labfans.com/bbs/showthread.php?t=26687)

poster 2019-12-14 20:46

如何解决hgload中的Matlab递归RecursionDetected错误?
 
我的Matlab GUI使用按钮单击来启动另一个GUI。

最近,我发现如果过分单击该按钮,则会导致Matlab崩溃并出现递归错误(请参见下面的说明)。是什么导致此递归错误,下一次如何解决?

[B]错误说明:[/B]

???在155使用==> hgload> localCheckRecursion时出错在加载c:\ Algo \ MyGUI.fig时发生递归。

==> hgload在56 Guard时出错= localCheckRecursion(fullpath); %#好

==> openfig在72时出错[fig,savedvisible] = hgload(filename,struct('Visible','off'));

在==> gui_mainfcn> local_openfig中出现错误286 gui_hFigure = openfig(name,singleton,visible);

==> gui_mainfcn错误159 gui_hFigure = local_openfig(gui_State.gui_Name,gui_SingletonOpt,gui_Visible);

==> PumpControl在42 gui_mainfcn(gui_State,varargin {:})时出错;



[B]回答:[/B]

重复单击GUI按钮可能导致多次调用按钮回调,这可能在某些时候相互中断并导致不必要的混乱。这可能是您遇到的问题。

您可以在MATLAB中设计GUI控件,以使其通过设置如下的[URL="http://www.mathworks.com/help/techdoc/ref/uicontrol_props.html#bqxoija"]'BusyAction'[/URL]和[URL="http://www.mathworks.com/help/techdoc/ref/uicontrol_props.html#bqxohrx"]'Interruptible'[/URL]属性(其中hButton是按钮对象的[URL="http://www.mathworks.com/help/techdoc/learn_matlab/f3-15974.html"]句柄)[/URL]来忽略快速单击,例如:

set(hButton,'BusyAction','cancel','Interruptible','off'); 将'Interruptible'设置为'off'意味着按钮回调在运行时不会被中断(某些“特殊”回调除外),而将'BusyAction'设置为'cancel'意味着在以下情况下将忽略按钮单击另一个回调(或它自己的)已经在执行。



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


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

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