how to fix my guide m file

hello, i am creating an interface using guide but when i write the axes program it keeps indicating this error "Error in @(hObject,eventdata)interfac('pushbutton_Callback',hObject,eventdata,guidata(hObject))""....can someone explain it or how can i fix it Thanks

7 Comments

Not without the code and the FULL error message (ALL the red text not just some of it). Please attach the m-file and fig file with the paper clip icon.
function varargout = interfac(varargin)
% INTERFAC MATLAB code for interfac.fig
% INTERFAC, by itself, creates a new INTERFAC or raises the existing
% singleton*.
%
% H = INTERFAC returns the handle to a new INTERFAC or the handle to
% the existing singleton*.
%
% INTERFAC('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in INTERFAC.M with the given input arguments.
%
% INTERFAC('Property','Value',...) creates a new INTERFAC or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before interfac_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to interfac_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to pushbutton (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help interfac
% Last Modified by GUIDE v2.5 28-May-2016 16:31:59
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @interfac_OpeningFcn, ...
'gui_OutputFcn', @interfac_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 interfac is made visible.
function interfac_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 interfac (see VARARGIN)
% Choose default command line output for interfac
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes interfac wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = interfac_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 during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton.
function pushbutton_Callback (hObject, eventdata, handles)
% hObject handle to pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc
val=get(handles.popupmenu1,'Value');
if val == 1
I=[];
a= 0
b=1
pas= 10^-4
lamda=850*10^-6;
delam=25*10^-6;
c=10^8
alfa =pi/(2*log(2));
nu=c/lamda
l=(b-a)/pas
i=1:l+1;
Idat=( 5*heaviside(i-1500)/5-2*heaviside(i-2500)/5-3*heaviside(i-5000)/5);%+sin(20*pi*nu*i);%+%
plot(Idat)
elseif val == 2
Idat=imread('retina.jpg');
% % % elseif
% % le cas des donnée de comsol
end
% Activer axes1
%Effacer axes1
axes(handles.axes2) % Activer axes2
cla
h = get(handles.panel,'SelectedObject');
s = get(h,'tag'); % Radiobouton sélectionné
switch s
case 'Data In'
Iint=0;
i=1:l+1;
ta=length(i)
ta=ta-1
for r=1 :l+1
n(r)=1;
if (r<l./2)
n(r)=.6;
else n(r)=.8;
% elseif (r<ta)
% n(r)=7;
end
end
for tau1=a:pas:b %indice i
j=1;
Iin=0;
for tau2=a:pas:b %indice j
v(j)=c./n(j) ;
k(j)=2*pi*nu./v(j);
deltaz(j)=2*(tau1-tau2);
rot(j)=exp(-(alfa*(delam*deltaz(j))/(lamda^2))^2);
Iint=Iint+sqrt(Idat(j))*rot(j)*cos(k(j)*(tau1-tau2));
j=j+1;
end
I=[I (Iint)];
plot(I)
end
% envlope
m = hilbert(I);
env = abs(m);
subplot(311),plot(pas*i,I)
subplot(312),plot(pas*i,[-1;1]*env,'r','LineWidth',2)
% partie positive
x=[-1;1]*env
x(x<0)=0
subplot(313),plot(pas*i,x)
case 'Traitement'
% % % case 'Reconstruction'
end
% --- Executes on button press in Traitement.
function Traitement_Callback(hObject, eventdata, handles)
% hObject handle to Traitement (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of Traitement
% --- Executes on button press in Reconstruction.
function Reconstruction_Callback(hObject, eventdata, handles)
% hObject handle to Reconstruction (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of Reconstruction
Shrug. You did not include the complete error message, you did not include the .fig file, you did not include instructions on how to recreate the error even if we had those.
Perhaps you do not have the Symbolic Toolbox installed. Perhaps you do not have retina.jpg in your current directory. Perhaps your object named "panel" is not a uibuttongroup and so does not have a SelectedObject property.
Evidently 'retina.jpg' is also required. Please upload everything we need so we can help you. Use the paperclip icon, unlike what you just did last time.
exactly my object 'panel' is a unipanel this is my err msg (Error using feval Undefined function 'axes1_CreateFcn' for input arguments of type 'double'.
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in interfac (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)interfac('axes1_CreateFcn',hObject,eventdata,guidata(hObject))
Error using struct2handle Error while evaluating axes CreateFcn
Error using feval Undefined function 'panel_CreateFcn' for input arguments of type 'double'.
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in interfac (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)interfac('panel_CreateFcn',hObject,eventdata,guidata(hObject))
Error using struct2handle Error while evaluating uipanel CreateFcn
Error using feval Undefined function 'axes1_CreateFcn' for input arguments of type 'double'.
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in interfac (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)interfac('axes1_CreateFcn',hObject,eventdata,guidata(hObject))
Error using struct2handle Error while evaluating axes CreateFcn
Error using feval Undefined function 'panel_CreateFcn' for input arguments of type 'double'.
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in interfac (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)interfac('panel_CreateFcn',hObject,eventdata,guidata(hObject))
Error using struct2handle Error while evaluating uipanel CreateFcn
Error using feval Undefined function 'axes1_CreateFcn' for input arguments of type 'double'.
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in interfac (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)interfac('axes1_CreateFcn',hObject,eventdata,guidata(hObject))
Error using struct2handle Error while evaluating axes CreateFcn
Error using feval Undefined function 'panel_CreateFcn' for input arguments of type 'double'.
Error in gui_mainfcn (line 96) feval(varargin{:});
Error in interfac (line 42) gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)interfac('panel_CreateFcn',hObject,eventdata,guidata(hObject))
Error using struct2handle Error while evaluating uipanel CreateFcn
>> )...forgive me i am quite a beginner in matlab ...thank you
Again, we're going to need the retina image won't we?
here it is the retina image (even u could of done it any img u have )

Sign in to comment.

Answers (2)

Adam
Adam on 28 May 2016
Edited: Adam on 28 May 2016
Open your fig in GUIDE, double click on Axes1, find the 'CreateFcn' property, select all the text in that field and delete it. Axes don't come with a CreateFcn by default so I don't know how you ended up with one, presumably by accident. I usually delete most of my component's CreateFcn's because they just add clutter to my .fig, but that is just my personal preference and the fact I don't write multi-platform code.
Image Analyst
Image Analyst on 29 May 2016
Do what Adam said but also do it for the panel. After you delete it hit return and save the .fig file. I did it and am attaching the two files. It now launches without error.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Tags

No tags entered yet.

Asked:

on 28 May 2016

Answered:

on 29 May 2016

Community Treasure Hunt

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

Start Hunting!