how to eliminate the uicontrol callback error

98 views (last 30 days)
Adnan Saify
Adnan Saify on 31 Dec 2015
Commented: Walter Roberson on 30 Dec 2020
t i am not getting rid of following errors(attached updated file)
??? Reference to non-existent field 'result'.
Error in ==> test1>pushbutton1_Callback at 151 set(handles.result,'String',total_matched_percentage);
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> test1 at 41 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)test1('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback thanx in advance
  4 Comments

Sign in to comment.

Answers (2)

Walter Roberson
Walter Roberson on 1 Jan 2016
Your code does not create handles.result so it is only going to exist if it is in your .fig file. If you were to post your .fig file then someone could check it.
  3 Comments
Image Analyst
Image Analyst on 1 Jan 2016
The code in that .m file is so poor that you would not want to model yours after it anyway. You'd be better off reading this and then coding it up yourself.

Sign in to comment.


vani shree
vani shree on 28 Mar 2017
Edited: Walter Roberson on 28 Mar 2017
Good evening sir, i m doing project under double encryption based method fuzzy vault method for finger print identification. i m getting error in this code like "gui_mainfcn(gui_State, varargin{:});" can you please help me.
thank you sir
function varargout = gui_final(varargin)
% GUI_FINAL M-file for gui_final.fig
% GUI_FINAL, by itself, creates a new GUI_FINAL or raises the existing
% singleton*.
%
% H = GUI_FINAL returns the handle to a new GUI_FINAL or the handle to
% the existing singleton*.
%
% GUI_FINAL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in GUI_FINAL.M with the given input arguments.
%
% GUI_FINAL('Property','Value',...) creates a new GUI_FINAL or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before gui_final_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to gui_final_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help gui_final
% Last Modified by GUIDE v2.5 28-Mar-2017 19:45:50
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @gui_final_OpeningFcn, ...
'gui_OutputFcn', @gui_final_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before gui_final is made visible.
function gui_final_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to gui_final (see VARARGIN)
% Choose default command line output for gui_final
handles.output = hObject;
a=ones([256 256]);
axes(handles.axes1);imshow(a);
axes(handles.axes2);imshow(a);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes gui_final wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = gui_final_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in inp_img.
function inp_img_Callback(hObject, eventdata, handles)
% hObject handle to inp_img (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
cd TestImages
file=uigetfile('*.bmp');
inp=imread(file);
cd ..
inp=imresize(inp,[240 240]);
axes(handles.axes1);
imshow(inp);title('Input Image');
handles.inp=inp;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in encrypt_img.
function encrypt_img_Callback(hObject, eventdata, handles)
% hObject handle to encrypt_img (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
inp=handles.inp;
[r c]=size(inp);
Enc_img=zeros([r c]);
u = 3.9999; x = 0.40000565;
len=r*c;
for i = 1:len
x = u.*x.*(1-x);
Eth1 = Ethreshold(x);
disp(Eth1);
Enc_img(i) = bitxor(inp(i),Eth1);
end
Enc_img=reshape(Enc_img,r,c);
axes(handles.axes2);
imshow(Enc_img,[]);title('Encrypted Image');
handles.Enc_img=Enc_img;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in segment_img.
function segment_img_Callback(hObject, eventdata, handles)
% hObject handle to segment_img (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Enc_img=handles.Enc_img;
inp=double(Enc_img);
[m n]=size(inp);
disp('ROW:');
disp(m);
disp('COLUMN:');
disp(n);
for i1=1:30
out1=inp(:,1:30);
end
figure;
subplot(2,4,1);
imshow(uint8(out1));title('Segment1');
for i2=31:60
out2=inp(:,31:60);
end
subplot(2,4,2);
imshow(uint8(out2));title('Segment2');
for i3=61:90
out3=inp(:,61:90);
end
subplot(2,4,3);
imshow(uint8(out3));title('Segment3');
for i4=91:120
out4=inp(:,91:120);
end
subplot(2,4,4);
imshow(uint8(out4));title('Segment4');
for i5=121:150
out5=inp(:,121:150);
end
subplot(2,4,5);
imshow(uint8(out5));title('Segment5');
for i6=151:180
out6=inp(:,151:180);
end
subplot(2,4,6);
imshow(uint8(out6));title('Segment6');
for i7=181:210
out7=inp(:,181:210);
end
subplot(2,4,7);
imshow(uint8(out7));title('Segment7');
for i8=211:240
out8=inp(:,211:240);
end
subplot(2,4,8);
imshow(uint8(out8));title('Segment8');
handles.out1=out1;
handles.out2=out2;
handles.out3=out3;
handles.out4=out4;
handles.out5=out5;
handles.out6=out6;
handles.out7=out7;
handles.out8=out8;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in features.
function features_Callback(hObject, eventdata, handles)
% hObject handle to features (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
out1=handles.out1;
out2=handles.out2;
out3=handles.out3;
out4=handles.out4;
out5=handles.out5;
out6=handles.out6;
out7=handles.out7;
out8=handles.out8;
feat11=mean(mean(out1));
feat12=entropy(out1);
feat21=mean(mean(out2));
feat22=entropy(out2);
feat31=mean(mean(out3));
feat32=entropy(out3);
feat41=mean(mean(out4));
feat42=entropy(out4);
feat51=mean(mean(out5));
feat52=entropy(out5);
feat61=mean(mean(out6));
feat62=entropy(out6);
feat71=mean(mean(out7));
feat72=entropy(out7);
feat81=mean(mean(out8));
feat82=entropy(out8);
Feat=[feat11 feat21 feat31 feat41 feat51 feat61 feat71 feat81;
feat12 feat22 feat32 feat42 feat52 feat62 feat72 feat82];
disp('Input Image Features:');
disp(Feat);
handles.Feat=Feat;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in fuzzy_vault.
function fuzzy_vault_Callback(hObject, eventdata, handles)
% hObject handle to fuzzy_vault (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%%Cover Media on POLYNOMIAL Values
x = linspace(0,4*pi,10);
y = tan(x);
p = polyfit(x,y,5);
x1 = linspace(0,2*pi);
y1 = polyval(p,x1);
figure;
plot(x1,y1,'o');title('Polynomial Values');
xlabel('time(secs)');
ylabel('amplitude');
handles.x1=x1;
handles.y1=y1;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in embedded_process.
function embedded_process_Callback(hObject, eventdata, handles)
% hObject handle to embedded_process (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
x1=handles.x1;
y1=handles.y1;
Feat=handles.Feat;
Feat=mean(mean(Feat));
Emb_value=Feat*y1;
figure;
plot(x1,Emb_value,'o');title('Peak Value Hided in Polynomial Values');
xlabel('time(secs)');
ylabel('amplitude');
handles.Emb_value=Emb_value;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in feat_fuzzy_vault.
function feat_fuzzy_vault_Callback(hObject, eventdata, handles)
% hObject handle to feat_fuzzy_vault (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Emb_value=handles.Emb_value;
fuzzy_vault_feat1=mean(Emb_value);
fuzzy_vault_feat2=entropy(Emb_value);
qfeat=[fuzzy_vault_feat1 fuzzy_vault_feat2]';
disp('Fuzzy Vault Features:');
disp(qfeat);
save X qfeat
handles.qfeat=qfeat;
% Update handles structure
guidata(hObject, handles);
% --- Executes on button press in data_base.
function data_base_Callback(hObject, eventdata, handles)
% hObject handle to data_base (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
for di=1:1:8
fname = strcat(int2str(di),'.bmp');
cd DATABASE
inp =imread(fname);
cd ..
inp=imresize(inp,[240 240]);
[r c]=size(inp);
Enc_img=zeros([r c]);
u = 3.9999; x = 0.40000565;
len=r*c;
for i = 1:len
x = u.*x.*(1-x);
Eth1 = Ethreshold(x);
disp(Eth1);
Enc_img(i) = bitxor(inp(i),Eth1);
end
Enc_img=reshape(Enc_img,r,c);
inp=double(Enc_img);
[m n]=size(inp);
for i1=1:30
out1=inp(:,1:30);
end
for i2=31:60
out2=inp(:,31:60);
end
for i3=61:90
out3=inp(:,61:90);
end
for i4=91:120
out4=inp(:,91:120);
end
for i5=121:150
out5=inp(:,121:150);
end
for i6=151:180
out6=inp(:,151:180);
end
for i7=181:210
out7=inp(:,181:210);
end
for i8=211:240
out8=inp(:,211:240);
end
feat11=mean(mean(out1));
feat12=entropy(out1);
feat21=mean(mean(out2));
feat22=entropy(out2);
feat31=mean(mean(out3));
feat32=entropy(out3);
feat41=mean(mean(out4));
feat42=entropy(out4);
feat51=mean(mean(out5));
feat52=entropy(out5);
feat61=mean(mean(out6));
feat62=entropy(out6);
feat71=mean(mean(out7));
feat72=entropy(out7);
feat81=mean(mean(out8));
feat82=entropy(out8);
Feat=[feat11 feat21 feat31 feat41 feat51 feat61 feat71 feat81;
feat12 feat22 feat32 feat42 feat52 feat62 feat72 feat82];
x = linspace(0,4*pi,10);
y = tan(x);
p = polyfit(x,y,5);
x1 = linspace(0,2*pi);
y1 = polyval(p,x1);
Feat=mean(mean(Feat));
Emb_value=Feat*y1;
fuzzy_vault_feat1=mean(Emb_value);
fuzzy_vault_feat2=entropy(Emb_value);
dbfeat=[fuzzy_vault_feat1 fuzzy_vault_feat2]';
disp('Fuzzy Vault Features:');
disp(dbfeat);
data_set_feat(:,di)=dbfeat;
end
disp(data_set_feat);
save Y data_set_feat
% --- Executes on button press in verification.
function verification_Callback(hObject, eventdata, handles)
% hObject handle to verification (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
load X qfeat
load Y data_set_feat
X1=mean(qfeat);
Y1=mean(data_set_feat);
verified=zeros([ 1 8]);
for j=1:8
verified(:,j)=X1-Y1(:,j);
end
disp(verified);
res=sort(verified);
if res(1,1) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,2) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,3) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,4) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,5) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,6) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,7) == 0;
helpdlg('AUTHENTICATE');
elseif res(1,8) == 0;
helpdlg('AUTHENTICATE');
else
helpdlg('UN-AUTHENTICATE');
end
this is my main coding.
  3 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!