Matlab与";评估UIcontrol回调时出错";

Matlab与";评估UIcontrol回调时出错";,matlab,Matlab,我有一个matlab文件,我不能在这里发布(3000行),其中包含许多从GUI使用的函数 我正在使用包含3000行代码的matlab文件,该文件具有许多用于设计GUI的功能 当我使用函数A时,与之相关的函数会使用其他几个函数,并使其成为一个循环,通过花费很长时间来运行多次函数A(1600-2000)迭代次数 当我达到400-500时,Matlab给了我 错误:“评估UIcontrol回调时出错” 我必须终止现有的进程,然后退出Matlab,并从给出错误的上一次迭代中再次运行。所以我的问题不是基于

我有一个matlab文件,我不能在这里发布(3000行),其中包含许多从GUI使用的函数

我正在使用包含3000行代码的matlab文件,该文件具有许多用于设计GUI的功能

当我使用
函数A
时,与之相关的函数会使用其他几个函数,并使其成为一个循环,通过花费很长时间来运行多次
函数A(1600-2000)
迭代次数

当我达到400-500时,Matlab给了我

错误:“评估UIcontrol回调时出错”

我必须终止现有的进程,然后退出Matlab,并从给出错误的上一次迭代中再次运行。所以我的问题不是基于函数调用,而是它可能是基于内存,也可能是临时内存

是否可以通过Matlab增加临时内存使用

我最大限度地增加了首选项“Java热内存”,但这个首选项并没有改变我的问题

有没有办法解决这个问题

脚本的一部分:

function CalculateManyOffset % It's Function A on this topic

mainfig         = FigHandle;
parameters      = get(mainfig,'UserData');

dbstop if error

NumberofProfiles = str2double(get(parameters.NumberofProfilesBox,'string'));
step = str2double(get(parameters.DistBetweenProfilesBox,'string'));

Alphabet=('A':'Z').';
[I,J] = meshgrid(1:26,1:26);
namered = [Alphabet(I(:)), Alphabet(J(:))];
namered = strvcat(namered)';

nameblue = [Alphabet(I(:)), Alphabet(J(:))];
nameblue = strvcat(nameblue)';

apostrophe = '''';

SaveNameDisplacementFile = [get(parameters.SaveNamebox,'string'),'.txt'];

a=0;
icounter = 0;
StartBlue = str2double(get(parameters.bluelinebox,'String'));
EndBlue = StartBlue + NumberofProfiles;
StartRed = str2double(get(parameters.redlinebox,'String'));
EndRed = StartRed + NumberofProfiles-15;
for i = StartBlue:step:EndBlue;
    icounter = icounter +1;
    jcounter = 0;
for j=StartRed:step:EndRed;  
    jcounter = jcounter +1;
    opthorz = [];
    maxGOF = [];
    a=[a(1)+1 length(StartRed:step:EndRed)*length(StartBlue:step:EndBlue)]
    %
    if a(1) >= 0 && a(1) <= 20000
    BlueLineDist  = 1*i;
    parameters.bluelinedist = i;
    RedLineDist = 1*j;
    parameters.redlinedist = j;
    parameters.i = icounter;
    parameters.j = jcounter;
    set(mainfig,'UserData',parameters,'HandleVisibility','callback'); % To update variable parameters for the function which use them (downside : BlueLine, RedLine, GetBlueProfile, GetRedProfile, CalculateOffset)
    BlueLine;
    RedLine;
    GetBlueProfile;
    GetRedProfile;
    CalculateOffset;        
% Now, reload variable parameters with new value calculate on previous functions
    mainfig         = FigHandle;
    parameters      = get(mainfig,'UserData');
    opthorz = parameters.opthorz;
    name = [num2str(namered(:,jcounter)'),num2str(nameblue(:,icounter)'),apostrophe];
    namefid2 = [num2str(namered(:,jcounter)'),' - ',num2str(nameblue(:,icounter)'),apostrophe];
    Distance = [num2str(RedLineDist),' - ',num2str(BlueLineDist)];
    maxGOF = parameters.maxGOF;
            % Create file with all displacements
    if a(1) == 1;   
        fid2 = fopen(SaveNameDisplacementFile,'w');         
        fprintf(fid2,['Profile red - blue\t','Distance (m) between profile red - blue with fault\t','Optimal Displacement\t','Goodness of Fit\t','20%% from Goodness of Fit\t','Minimal Displacement\t','Maximal Displacement \n']);
        fprintf(fid2,[namefid2,'\t',Distance,'\t',num2str(opthorz),'\t',num2str(maxGOF),'\t',num2str(parameters.ErrorGOF),'\t',num2str(parameters.ErrorDisp(1,1)),'\t',num2str(parameters.ErrorDisp(1,2)),'\n']);
    elseif a(1) ~= b(end);
        fid2 = fopen(SaveNameDisplacementFile,'a');
        fprintf(fid2,[namefid2,'\t',Distance,'\t',num2str(opthorz),'\t',num2str(maxGOF),'\t',num2str(parameters.ErrorGOF),'\t',num2str(parameters.ErrorDisp(1,1)),'\t',num2str(parameters.ErrorDisp(1,2)),'\n']);
    else
        fid2 = fopen(SaveNameDisplacementFile,'a');
        fprintf(fid2,[namefid2,'\t',Distance,'\t',num2str(opthorz),'\t',num2str(maxGOF),'\t',num2str(parameters.ErrorGOF),'\t',num2str(parameters.ErrorDisp(1,1)),'\t',num2str(parameters.ErrorDisp(1,2))]);
        fclose(fid2);
    end       
end
end
end
函数CalculateManyOffset%此主题为函数A
mainfig=FigHandle;
参数=get(mainfig,'UserData');
dbstop中频错误
NumberofProfiles=str2double(get(parameters.NumberofProfilesBox,'string');
step=str2double(get(parameters.distbetweenprofilebox,'string');
字母表=('A':'Z');
[I,J]=meshgrid(1:26,1:26);
namered=[字母表(I(:)),字母表(J(:)];
namered=strvcat(namered)';
nameblue=[字母表(I(:)),字母表(J(:)];
nameblue=strvcat(nameblue)';
撇号='';
SaveNameDisplacementFile=[get(parameters.SaveNamebox,'string'),'.txt'];
a=0;
i计数器=0;
StartBlue=str2double(get(parameters.bluelinebox,'String');
EndBlue=开始蓝色+NumberofProfiles;
StartRed=str2double(get(parameters.redlinebox,'String');
EndRed=起始日期+编号-15;
对于i=开始蓝色:步骤:结束蓝色;
i计数器=i计数器+1;
jcounter=0;
对于j=StartRed:step:EndRed;
jcounter=jcounter+1;
opthorz=[];
maxGOF=[];
a=[a(1)+1长度(起始:步长:结束红色)*长度(起始蓝色:步长:结束蓝色)]
%

如果a(1)>=0&&a(1),您可以发布有关函数a的更多信息吗?您能否在GUI之外运行该功能并使其正常工作?如果首先运行
>dbstop if error
,当遇到错误时,MATLAB会做什么?我将尝试
dbstop if error
,并将结果发布在这里。我从不尝试在GUI之外运行函数,因为我在它上面放了一些值,这些值用于函数中的变量。函数A创建一些通过
print
函数保存的图形。如果出现错误,我会写入
dbstop,并且错误再次出现:
在评估UIControl回调时出错。它不是写“忙”,而是“在调试器中停止”(在左下角)。我没有更多关于
dbstop if error
的信息,如果是内存问题,Matlab会在错误消息中指出。请给出完整准确的错误消息(而不仅仅是它的位置)。当您遇到错误时,dbstop if error将使您处于调试模式。这意味着您可以查看发生错误的代码行,并尝试查看发生的情况。您可以发布有关函数A的更多信息吗?您能否在GUI之外运行该功能并使其正常工作?如果首先运行
>dbstop if error
,当遇到错误时,MATLAB会做什么?我将尝试
dbstop if error
,并将结果发布在这里。我从不尝试在GUI之外运行函数,因为我在它上面放了一些值,这些值用于函数中的变量。函数A创建一些通过
print
函数保存的图形。如果出现错误,我会写入
dbstop,并且错误再次出现:
在评估UIControl回调时出错。它不是写“忙”,而是“在调试器中停止”(在左下角)。我没有更多关于
dbstop if error
的信息,如果是内存问题,Matlab会在错误消息中指出。请给出完整准确的错误消息(而不仅仅是它的位置)。当您遇到错误时,dbstop if error将使您处于调试模式。这意味着您可以查看发生错误的代码行,并尝试查看发生的情况。