필터 지우기
필터 지우기

my code gui error

조회 수: 1 (최근 30일)
Tanachaporn
Tanachaporn 2014년 12월 11일
댓글: Tanachaporn 2014년 12월 17일
Hello my code gui can run passed but the error when this appear in my command window when i run my GUI.
that my code
function varargout = bebear(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @bebear_OpeningFcn, ...
'gui_OutputFcn', @bebear_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
%'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
function bebear_OpeningFcn(hObject, eventdata, handles, varargin)
get(eventdata)
handles.output = hObject;
guidata(hObject, handles);
end
function varargout = bebear_OutputFcn(hObject, eventdata, handles)
get(hObject)
get(eventdata)
varargout{1} = handles.output;
end
function browse_human_Callback(hObject, eventdata, handles)
get(hObject)
get(eventdata)
[filename pathname] = uigetfile({'*.jpg';'*.png'},'File Selector');
image = strcat(pathname, filename);
axes(handles.axes1)
imshow(image)
h = imline;
setColor(h,[1 0 0]);
%position = wait(h);
global posH
posH = getPosition(h)
end
function browse_bear_Callback(hObject, eventdata, handles)
get(hObject)
get(eventdata)
[filename pathname] = uigetfile({'*.jpg';'*.png'},'File Selector');
image = strcat(pathname, filename);
axes(handles.axes2)
imshow(image)
b = imline;
setColor(b,[1 0 0]);
%position = wait(h);
global posB
posB = getPosition(b)
end
function cal_CreateFcn(hObject, eventdata, handles)
end
function calculate_Callback(hObject, eventdata, handles)
tallH = str2double(get(handles.height_hu,'String'));
get(hObject)
get(eventdata)
global posH
global posB
sumH = posH;
sumhY1 = posH(1,2);
sumhY2 = posH(2,2);
lineH = sumhY2 - sumhY1
sumB = posB;
sumbY1 = posB(1,2);
sumbY2 = posB(2,2);
lineB = sumbY2 - sumbY1
tallB = (tallH/lineH)* lineB
set(handles.height_bear, 'String', tallB)
end
function pic_CreateFcn(hObject, eventdata, handles)
get(hObject);
get(eventdata);
get(handles);
image = imread('bear.png');
imshow(image)
end
error massage:
??? Error using ==> feval
Undefined function or method 'height_bear_CreateFcn' for input arguments of type 'double'.
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> bebear at 18
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)bebear('height_bear_CreateFcn',hObject,eventdata,guidata(hObject))
?? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn
how can I fix it

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 12월 12일
편집: Geoff Hayes 2014년 12월 12일
Tanachaporn - the error message is telling you that the function height_bear_CreateFcn cannot be found. Did you perhaps delete this function from your m file, or maybe rename it in the editor? In GUIDE, use the property editor to look at the CreateFcn for each of your controls to see which one has this function, and take the appropriate action. Else attach your GUI fig file so that we can see what is going wrong.

추가 답변 (3개)

SRI
SRI 2014년 12월 12일
Hi error associated with the code is "Undefined function or method 'height_bear_CreateFcn' for input arguments of type 'double".
you dint mention the function height_bear in your designed gui so that if you write anything in that function means it will not run, because all the code in the main function will call from the gui and it will run, here in the designed gui there is no function related to height_bear, kindly insert that handles in your gui, so that your code will run
  댓글 수: 1
Tanachaporn
Tanachaporn 2014년 12월 17일
it work too thank you

댓글을 달려면 로그인하십시오.


Tanachaporn
Tanachaporn 2014년 12월 13일
Thank you that work!

SRI
SRI 2014년 12월 16일
If my suggestion is correct kindly accept my answer

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by