How do I fix this! I just started to learn about it

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

What is your question? Do you have any error?
1.Reference to non-existent field 'axes1'.
2.Error in xulianh>pushbutton1_Callback (line 101)
axes(handles.axes1);
3.Error in gui_mainfcn (line 95)
feval(varargin{:});
4.Error in xulianh (line 42)
gui_mainfcn(gui_State, varargin{:});
5.Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)xulianh('pushbutton1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
=)) i dont know. Can u help me, Sir?
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.
Thank you Sir, actually i want to try it in Matlab in advance, after that i will create a interface image processing by OpenCV, because i think, basically, their algorithm is the same between Matlab and Opencv. I will go back to the drawing board. Ff you don't mind, Please give me a contact address to receive your help in the future. Thank you once again.

Sign in to comment.

Answers (2)

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

Yah, thank you, Sir. i dont have more time to start from simple things. i try more everyday to complete my project in little time

Sign in to comment.

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

Asked:

on 29 Oct 2019

Commented:

on 30 Oct 2019

Community Treasure Hunt

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

Start Hunting!