MATLAB Answers

0

error: 'gui_mainfcn' undefined near line 42 column 5 error: execution exception in demo.m

Asked by vandana matai on 12 Jul 2018
Latest activity Commented on by Walter Roberson
on 14 Jul 2018
function varargout = ff(varargin)
% FF M-file for ff.fig
% FF, by itself, creates a new FF or raises the existing
% singleton*.
%
% H = FF returns the handle to a new FF or the handle to
% the existing singleton*.
%
% FF('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FF.M with the given input arguments.
%
% FF('Property','Value',...) creates a new FF or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ff_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ff_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 ff
% Last Modified by GUIDE v2.5 10-Jul-2018 20:16:15
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ff_OpeningFcn, ...
'gui_OutputFcn', @ff_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 ff is made visible.
function ff_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 ff (see VARARGIN)
% Choose default command line output for ff
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes ff wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = ff_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 blacknwhite.
function blacknwhite_Callback(hObject, eventdata, handles)
% hObject handle to blacknwhite (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%this is for white and black images
global im
imblack=im;
imblack=1-im;
axes(handles.axes1);
imshow(imblack);
% --- Executes on button press in gray_scale.
function gray_scale_Callback(hObject, eventdata, handles)
% hObject handle to gray_scale (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%here we convert image to grayscale using r=g=b=(r+g+b)/3
global im
imgray=(im(:,:,1)+im(:,:,2)+im(:,:,2))/3;
axes(handles.axes1);
imshow(imgray);
% --- Executes on button press in dilati_on.
function dilati_on_Callback(hObject, eventdata, handles)
% hObject handle to dilati_on (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im
imdil=imgaussfilt3(im,2);
axes(handles.axes1);
imshow(imdil);
% --- Executes on button press in erosi_on.
function erosi_on_Callback(hObject, eventdata, handles)
% hObject handle to erosi_on (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im
H = fspecial('motion',20,45);
MotionBlur = imfilter(im,H,'replicate');
axes(handles.axes1);
imshow(MotionBlur);
% --- Executes on button press in load.
function load_Callback(hObject, eventdata, handles)
% hObject handle to load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%here we load image
global im im2
[path,user_cance]=imgetfile();
if user_cance
msgbox(sprintf('error'),'error','error');
return
end
im=imread(path);
im=im2double(im);
im2=im;
axes(handles.axes1);
imshow(im);
% --- Executes on button press in reset.
function reset_Callback(hObject, eventdata, handles)
% hObject handle to reset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global im2
axes(handles.axes1);
imshow(im2);

  4 Comments

Show 1 older comment
First try
restoredefaultpath
and try again. If that does not work, then you may need to reinstall MATLAB (but not any toolboxes.)

Sign in to comment.

0 Answers