how to solve the uicontrol callback errors in gui for regonition
조회 수: 4 (최근 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
댓글 수: 0
답변 (2개)
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().
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
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 Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!