how to solve the uicontrol callback errors in gui for regonition

8 Ansichten (letzte 30 Tage)
dhvani patel
dhvani patel am 10 Mär. 2015
Kommentiert: Image Analyst am 19 Mär. 2015
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

Antworten (2)

Image Analyst
Image Analyst am 10 Mär. 2015
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 Kommentar
dhvani patel
dhvani patel am 10 Mär. 2015
respected sir, thanking you.. i hav kept the entire codes in the other questions that will be easy for u to recognize the error..

Melden Sie sich an, um zu kommentieren.


Eliza Tham
Eliza Tham am 19 Mär. 2015
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 Kommentar
Image Analyst
Image Analyst am 19 Mär. 2015
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by