Thread Subject: Urgent??? Error while evaluating uicontrol Callback

Subject: Urgent??? Error while evaluating uicontrol Callback

From: Abhik Lodh

Date: 23 Jan, 2008 06:37:03

Message: 1 of 2

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)

Subject: Urgent??? Error while evaluating uicontrol Callback

From: Titus

Date: 24 Jan, 2008 12:25:47

Message: 2 of 2


"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


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
error while evaluating uicontrol callback Abhik Lodh 23 Jan, 2008 01:40:23
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com