How do I fix this! I just started to learn about it
Show older comments
function varargout = xulianh(varargin)
% XULIANH MATLAB code for xulianh.fig
% XULIANH, by itself, creates a new XULIANH or raises the existing
% singleton*.
%
% H = XULIANH returns the handle to a new XULIANH or the handle to
% the existing singleton*.
%
% XULIANH('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in XULIANH.M with the given input arguments.
%
% XULIANH('Property','Value',...) creates a new XULIANH or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before xulianh_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to xulianh_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help xulianh
% Last Modified by GUIDE v2.5 29-Oct-2019 20:56:28
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @xulianh_OpeningFcn, ...
'gui_OutputFcn', @xulianh_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 xulianh is made visible.
function xulianh_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to xulianh (see VARARGIN)
% Choose default command line output for xulianh
handles.output = hObject;
set(hObject,'toolbar','figure');
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes xulianh wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = xulianh_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)
global w
[FileName,PathName] = uigetfile({'*.jpg;*.JPG','JPG Files (*.jpg, *JPG)';
'*.tif;*.TIF','TIF Files (*.tif, *.TIF)';...
'*.gif;*.GIF','GIF Files (*.gif, *.GIF)';...
'*.png;*.PNG','PNG Files (*.png, *.PNG)';...
'*.bmp;*.BMP','BMP Files (*.bmp, *.BMP)';...
'*.*','All Files(*.*)'},'Select the input file');
if ~strcmp (FileName,'')
fullname= strcat(PathName,FileName);
w=imread(fullname);
w_red = w(:,:,1);
w_green = w(:,:,2);
w_blue = w(:,:,3);
J_red = wiener2(w_red,[5 5]);
J_green = wiener2(w_green,[5 5]);
J_blue = wiener2(w_blue,[5 5]);
w(:,:,1)= J_red;
w(:,:,2)= J_green;
w(:,:,3)= J_blue;
axes(handles.axes1);
imshow(w);
end
axes(handles.Edited);
cla(handles.Edited,'reset');
set(handles.Edited,'visible','off');
4 Comments
Alex Mcaulley
on 29 Oct 2019
What is your question? Do you have any error?
Nguyen Khac Thinh
on 29 Oct 2019
Well, the error tells you all. You're trying to use the field axes1 from handle, but that field doesn't exist. Indeed it's never created in your code.
We can guess that it's supposed to be a handle to an axis in your figure but you never create such axis.
I'll repeat what I said in my answer. If you are a beginner in matlab, App Designer is much easier to work with than GUIDE.
Nguyen Khac Thinh
on 30 Oct 2019
Answers (2)
Guillaume
on 29 Oct 2019
0 votes
If you are starting to learn matlab, then I would strongly recommend you learn to create GUIs using App designer instead of GUIDE (what you are using now). GUIDE is going to be deprecated soonish so learning it now might be a waste of time, and writing GUIs in app designer is a lot easier than with guide.
1 Comment
Nguyen Khac Thinh
on 29 Oct 2019
Steven Lord
on 29 Oct 2019
0 votes
I suspect you tried to start your GUI by opening the figure file (double-clicking on it perhaps?) You need to start a GUIDE GUI by running the associated function (to initialize the GUI) not opening the figure file directly. Type the name of the function in the MATLAB Command Window and see if you still receive this error.
Categories
Find more on Programming Utilities in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!