can anyone fix this issue?
1 回表示 (過去 30 日間)
古いコメントを表示
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)plz('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback
and my code is
function varargout = plz(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @plz_OpeningFcn, ...
'gui_OutputFcn', @plz_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{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before plz is made visible.
function plz_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for plz
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes plz wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = plz_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[c, d] = uigetfile({'*.*' , 'all files'});
imj = imread([c , d]);
s = imshow(imj , 'parent' , handles.axes1);
imshow(s);
採用された回答
Walter Roberson
2016 年 5 月 1 日
The order of outputs from uigetfile is file name first and then directory. Your use of [c , d] has the components in the wrong order.
What you should use instead of [c, d] is fullfile(d, c)
filename = fullfile(d, c);
imj = imread(filename);
2 件のコメント
Walter Roberson
2016 年 5 月 1 日
I do not answer much of my email. I respond more to posted questions.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!