how to solve the uicontrol callback errors in gui for regonition

1 回表示 (過去 30 日間)
dhvani patel
dhvani patel 2015 年 3 月 10 日
コメント済み: Image Analyst 2015 年 3 月 19 日
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 Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by