For Programmers: Free Programming Magazines  


Home > Archive > Matlab > January 2008 > Urgent??? Error while evaluating uicontrol Callback









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Urgent??? Error while evaluating uicontrol Callback
Abhik Lodh

2008-01-23, 8:57 am

Please help to solve the Error:

##### Following error generated
??? Reference to non-existent field 'Crossover'.

Error in ==> C:\MATLAB6p5\work\seg.m (Crossover_Callback)
On line 315 ==> x=handles.metricdata.Crossover;

Error in ==> C:\MATLAB6p5
\toolbox\matlab\uitools\gui_mainfcn.m
On line 66 ==> feval(varargin{:});

Error in ==> C:\MATLAB6p5\work\seg.m
On line 42 ==> gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.
[color=darkred]

%%%%%The code for the button Crossover%%%%%
function Crossover_Callback(hObject, eventdata, handles)
% hObject handle to Crossover (see GCBO)
% eventdata reserved - to be defined in a future version
of MATLAB
% handles structure with handles and user data (see
GUIDATA)
clc;
aa=handles.metricdata.pushbutton2;
ipkno=aa(1:22);
ipfitness=aa(23);
maindb=dlmread('kbase.txt');
dbfitness=maindb(:,23);
dbthre=maindb(:,24);
dbkno=maindb(:,1:22);
x=handles.metricdata.Crossover;
if x==0;
[ss dd]=min(abs(dbfitness-ipfitness));
x=dbkno(dd,:);
end
a1=[x(1:6) ipkno(7:14) x(15:22)];
a2=[ipkno(1:6) x(7:14) ipkno(15:22)];
fa1=a1*([1:22].*[1:22])';
fa2=a2*([1:22].*[1:22])';
if abs(ipfitness-fa1)<abs(ipfitness-fa2)
ca=a1;
fca=fa2;
else
ca=a2;
fca=fa2;
end
[ss dd]=min(abs(dbfitness-fca));
x=dbkno(dd,:);
newthre=dbthre(dd)/10000;
disp(x);
file=handles.metricdata.pushbutton1;
a=rgb2gray(imread(file));
disp(dbfitness(dd));
a=histeq(a);
opim=edge(a,newthre);
opim=imdilate(opim,ones(2,2));
subplot(2,2,4);
imshow(opim);
set(handles.threshold_text , 'String',num2str(newthre));
handles.metricdata.Crossover=x;
guidata(hObject,handles)

Titus

2008-01-24, 8:57 am


"Abhik Lodh" <abhik_lodh@sify.com> schrieb im Newsbeitrag
news:fn6naf$r6j$1@fred.mathworks.com...
> Please help to solve the Error:
>
> ##### Following error generated
> ??? Reference to non-existent field 'Crossover'.
>
> Error in ==> C:\MATLAB6p5\work\seg.m (Crossover_Callback)
> On line 315 ==> x=handles.metricdata.Crossover;
>
> Error in ==> C:\MATLAB6p5
> \toolbox\matlab\uitools\gui_mainfcn.m
> On line 66 ==> feval(varargin{:});
>
> Error in ==> C:\MATLAB6p5\work\seg.m
> On line 42 ==> gui_mainfcn(gui_State, varargin{:});
>
> ??? Error while evaluating uicontrol Callback.
>
>
> %%%%%The code for the button Crossover%%%%%
> function Crossover_Callback(hObject, eventdata, handles)
> % hObject handle to Crossover (see GCBO)
> % eventdata reserved - to be defined in a future version
> of MATLAB
> % handles structure with handles and user data (see
> GUIDATA)
> clc;
> aa=handles.metricdata.pushbutton2;
> ipkno=aa(1:22);
> ipfitness=aa(23);
> maindb=dlmread('kbase.txt');
> dbfitness=maindb(:,23);
> dbthre=maindb(:,24);
> dbkno=maindb(:,1:22);
> x=handles.metricdata.Crossover;
> if x==0;
> [ss dd]=min(abs(dbfitness-ipfitness));
> x=dbkno(dd,:);
> end
> a1=[x(1:6) ipkno(7:14) x(15:22)];
> a2=[ipkno(1:6) x(7:14) ipkno(15:22)];
> fa1=a1*([1:22].*[1:22])';
> fa2=a2*([1:22].*[1:22])';
> if abs(ipfitness-fa1)<abs(ipfitness-fa2)
> ca=a1;
> fca=fa2;
> else
> ca=a2;
> fca=fa2;
> end
> [ss dd]=min(abs(dbfitness-fca));
> x=dbkno(dd,:);
> newthre=dbthre(dd)/10000;
> disp(x);
> file=handles.metricdata.pushbutton1;
> a=rgb2gray(imread(file));
> disp(dbfitness(dd));
> a=histeq(a);
> opim=edge(a,newthre);
> opim=imdilate(opim,ones(2,2));
> subplot(2,2,4);
> imshow(opim);
> set(handles.threshold_text , 'String',num2str(newthre));
> handles.metricdata.Crossover=x;
> guidata(hObject,handles)
>



Hi,
put a breakpoint on line 315 of seg.m and you will see, that
handles.metricdata does not (yet?) contain a field Crossover.
Where should this have been added to the handles structure?
Probably at the same time, as pushbutton1 has been added.
Take a look around there ...

Titus


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com