how to solve the uicontrol callback errors in gui for regonition

3 次查看(过去 30 天)
gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @MAIN_OpeningFcn, ... 'gui_OutputFcn', @MAIN_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{:}); [LINE 28] end
************************************************ ERROR:- Error in MAIN (line 28) gui_mainfcn(gui_State, varargin{:});
--- Executes on button press in RECOGNITION.
function RECOGNITION_Callback(hObject, eventdata, handles)
% hObject handle to RECOGNITION (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
rec=handles.N; {LINE 260]
TrainDatabasePath = ('C:\pro_mat_file\Sap_codes\int_pro\project\TrainDatabase\');
TestDatabasePath =( 'C:\pro_mat_file\Sap_codes\int_pro\project\TrainDatabase\');
v=rec;
for j = 1:v
TestImage = num2str(j);
s=strcat('a',TestImage);
TestImage = strcat(TestDatabasePath,'\',char( TestImage),'.jpg');
T = CreateDatabase(TrainDatabasePath);
[m, A, Eigenfaces] = EigenfaceCore(T);
OutputName = Recognition(TestImage, m, A, Eigenfaces);
SelectedImage = strcat(TrainDatabasePath,'\', OutputName);
SelectedImage = imread(SelectedImage);
axes(eval(['handles.axes', num2str(s)]));
imshow(SelectedImage);
end
%
****************************************** ERROR:- Reference to non-existent field 'N'.
Error in MAIN>RECOGNITION_Callback (line 260) rec=handles.N;
Error in @(hObject,eventdata)MAIN('RECOGNITION_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback

回答(2 个)

Image Analyst
Image Analyst 2015-3-10
There is no field called N on the handles structure. If you set it somewhere, in some other function, then you forgot to either pass handles back out of that function, or you didn't call guidata().
  1 个评论
dhvani patel
dhvani patel 2015-3-10
respected sir, thanking you.. i hav kept the entire codes in the other questions that will be easy for u to recognize the error..

请先登录,再进行评论。


Eliza Tham
Eliza Tham 2015-3-19
HI, are you able to solve the problem? i am also running the same code gotten online and happen to face the same problem.
  1 个评论
Image Analyst
Image Analyst 2015-3-19
My answer would have solved it. Post your m-file and fig file in a new question so we can solve your related problem too.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by