Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
feval error message when opening a GUI

Subject: feval error message when opening a GUI

From: John

Date: 12 Jul, 2010 11:33:05

Message: 1 of 12

% Hi!

% I open up my GUI and get the following error:

??? Error using ==> feval
Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.

Error in ==> gui_mainfcn at 96
        feval(varargin{:});

Error in ==> DataGrabber_GUI at 42
    gui_mainfcn(gui_State, varargin{:});

Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))


??? Error using ==> struct2handle
Error while evaluating figure CreateFcn

% Any idea why this is happening and how to fix it?

Thanks,

JF

Subject: feval error message when opening a GUI

From: Paul

Date: 12 Jul, 2010 11:50:23

Message: 2 of 12

"John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> % Hi!
>
> % I open up my GUI and get the following error:
>
> ??? Error using ==> feval
> Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> DataGrabber_GUI at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
>
>
> ??? Error using ==> struct2handle
> Error while evaluating figure CreateFcn
>
> % Any idea why this is happening and how to fix it?
>
> Thanks,
>
> JF

This happens when the matlab cannot find the control (button, axes, radio button, label and so on) in the .fig file which has a function assigned in the .m file.

If it is a figure, it is very probably that you change the name of the entire figure (main GUI window). Check the names and try to rename them in the right way.

Subject: feval error message when opening a GUI

From: John

Date: 12 Jul, 2010 12:28:05

Message: 3 of 12

"Paul " <paul_tutzu@yahoo.com> wrote in message <i1evhv$4m2$1@fred.mathworks.com>...
> "John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> > % Hi!
> >
> > % I open up my GUI and get the following error:
> >
> > ??? Error using ==> feval
> > Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
> >
> > Error in ==> gui_mainfcn at 96
> > feval(varargin{:});
> >
> > Error in ==> DataGrabber_GUI at 42
> > gui_mainfcn(gui_State, varargin{:});
> >
> > Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
> >
> >
> > ??? Error using ==> struct2handle
> > Error while evaluating figure CreateFcn
> >
> > % Any idea why this is happening and how to fix it?
> >
> > Thanks,
> >
> > JF
>
> This happens when the matlab cannot find the control (button, axes, radio button, label and so on) in the .fig file which has a function assigned in the .m file.
>
> If it is a figure, it is very probably that you change the name of the entire figure (main GUI window). Check the names and try to rename them in the right way.

I looked through my file for any phantom controls (both visually and by using the Object Browser) and have not found anything I'm not expecting. The only things that don't have code are the uipanels. I did, however, delete some controls from my GUI recently and I'm pretty sure I was careful to delete the callbacks for all of these controls (it was after I deleted these controls that I started to see this error). Did I not dig far enough when deleting the callbacks?

Thanks,

JF

Subject: feval error message when opening a GUI

From: Paul

Date: 12 Jul, 2010 12:43:04

Message: 4 of 12

"John " <jfishbac@gmail.com> wrote in message <i1f1ol$qj5$1@fred.mathworks.com>...
> "Paul " <paul_tutzu@yahoo.com> wrote in message <i1evhv$4m2$1@fred.mathworks.com>...
> > "John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> > > % Hi!
> > >
> > > % I open up my GUI and get the following error:
> > >
> > > ??? Error using ==> feval
> > > Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
> > >
> > > Error in ==> gui_mainfcn at 96
> > > feval(varargin{:});
> > >
> > > Error in ==> DataGrabber_GUI at 42
> > > gui_mainfcn(gui_State, varargin{:});
> > >
> > > Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
> > >
> > >
> > > ??? Error using ==> struct2handle
> > > Error while evaluating figure CreateFcn
> > >
> > > % Any idea why this is happening and how to fix it?
> > >
> > > Thanks,
> > >
> > > JF
> >
> > This happens when the matlab cannot find the control (button, axes, radio button, label and so on) in the .fig file which has a function assigned in the .m file.
> >
> > If it is a figure, it is very probably that you change the name of the entire figure (main GUI window). Check the names and try to rename them in the right way.
>
> I looked through my file for any phantom controls (both visually and by using the Object Browser) and have not found anything I'm not expecting. The only things that don't have code are the uipanels. I did, however, delete some controls from my GUI recently and I'm pretty sure I was careful to delete the callbacks for all of these controls (it was after I deleted these controls that I started to see this error). Did I not dig far enough when deleting the callbacks?
>
> Thanks,
>
> JF

I think I got it.

The figure1 is the default tag for the GUI. You created the GUI window, created a CreateFcn function for the GUI when the tag of the window was figure1. After that you changed the name of the tag.

So, go in the main GUI window, right-click, click on Property Inspector, search in the list for Tag and I can bet that the name is not 'figure1' anymore. You have more choices: change the name of the function to fit for the new Tag or delete the function if it contains no code (it will be automatically generated with the right name if you will ever need it in the future).

Let me know if this was useful.

Paul

So click on the

Subject: feval error message when opening a GUI

From: Walter Roberson

Date: 12 Jul, 2010 12:58:24

Message: 5 of 12

John wrote:
> "Paul " <paul_tutzu@yahoo.com> wrote in message
> <i1evhv$4m2$1@fred.mathworks.com>...
>> "John " <jfishbac@gmail.com> wrote in message
>> <i1euhh$sgj$1@fred.mathworks.com>...

>> > > % I open up my GUI and get the following error:
>> > > ??? Error using ==> feval
>> > Undefined function or method 'figure1_CreateFcn' for input arguments
>> of type 'double'.

>> This happens when the matlab cannot find the control (button, axes,
>> radio button, label and so on) in the .fig file which has a function
>> assigned in the .m file.

> I looked through my file for any phantom controls (both visually and by
> using the Object Browser) and have not found anything I'm not expecting.

The error can also occur if you open the fig file directly instead of
opening the .m file for the GUI.

 > Did I not dig far enough when deleting the callbacks?

Possibly.

Subject: feval error message when opening a GUI

From: John

Date: 12 Jul, 2010 13:08:04

Message: 6 of 12

"Paul " <paul_tutzu@yahoo.com> wrote in message <i1f2ko$n7g$1@fred.mathworks.com>...
> "John " <jfishbac@gmail.com> wrote in message <i1f1ol$qj5$1@fred.mathworks.com>...
> > "Paul " <paul_tutzu@yahoo.com> wrote in message <i1evhv$4m2$1@fred.mathworks.com>...
> > > "John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> > > > % Hi!
> > > >
> > > > % I open up my GUI and get the following error:
> > > >
> > > > ??? Error using ==> feval
> > > > Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
> > > >
> > > > Error in ==> gui_mainfcn at 96
> > > > feval(varargin{:});
> > > >
> > > > Error in ==> DataGrabber_GUI at 42
> > > > gui_mainfcn(gui_State, varargin{:});
> > > >
> > > > Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
> > > >
> > > >
> > > > ??? Error using ==> struct2handle
> > > > Error while evaluating figure CreateFcn
> > > >
> > > > % Any idea why this is happening and how to fix it?
> > > >
> > > > Thanks,
> > > >
> > > > JF
> > >
> > > This happens when the matlab cannot find the control (button, axes, radio button, label and so on) in the .fig file which has a function assigned in the .m file.
> > >
> > > If it is a figure, it is very probably that you change the name of the entire figure (main GUI window). Check the names and try to rename them in the right way.
> >
> > I looked through my file for any phantom controls (both visually and by using the Object Browser) and have not found anything I'm not expecting. The only things that don't have code are the uipanels. I did, however, delete some controls from my GUI recently and I'm pretty sure I was careful to delete the callbacks for all of these controls (it was after I deleted these controls that I started to see this error). Did I not dig far enough when deleting the callbacks?
> >
> > Thanks,
> >
> > JF
>
> I think I got it.
>
> The figure1 is the default tag for the GUI. You created the GUI window, created a CreateFcn function for the GUI when the tag of the window was figure1. After that you changed the name of the tag.
>
> So, go in the main GUI window, right-click, click on Property Inspector, search in the list for Tag and I can bet that the name is not 'figure1' anymore. You have more choices: change the name of the function to fit for the new Tag or delete the function if it contains no code (it will be automatically generated with the right name if you will ever need it in the future).
>
> Let me know if this was useful.
>
> Paul
>
> So click on the

Paul,

Thanks, I got rid of the error by RE-generating the createfcn for figure1. What I think ACTUALLY was going on was that at one time I generated a createfcn and then deleted it from the M-File. By putting the createfcn back in my GUI.m, I no longer get the error.

BUT now i have a create function that I don't *think* needs to be there. I have a bunch of panels without create functions and I'm not getting errors for those controls. Any ideas on THIS? Can / how can I delete this create function without generating the error?

Thanks,

Thanks!

Subject: feval error message when opening a GUI

From: Steven Lord

Date: 12 Jul, 2010 13:29:59

Message: 7 of 12


"John " <jfishbac@gmail.com> wrote in message
news:i1f43k$r05$1@fred.mathworks.com...
> "Paul " <paul_tutzu@yahoo.com> wrote in message
> <i1f2ko$n7g$1@fred.mathworks.com>...
>> "John " <jfishbac@gmail.com> wrote in message
>> <i1f1ol$qj5$1@fred.mathworks.com>...
>> > "Paul " <paul_tutzu@yahoo.com> wrote in message
>> > <i1evhv$4m2$1@fred.mathworks.com>...
>> > > "John " <jfishbac@gmail.com> wrote in message
>> > > <i1euhh$sgj$1@fred.mathworks.com>...

*snip*

> Paul,
>
> Thanks, I got rid of the error by RE-generating the createfcn for figure1.
> What I think ACTUALLY was going on was that at one time I generated a
> createfcn and then deleted it from the M-File. By putting the createfcn
> back in my GUI.m, I no longer get the error.
> BUT now i have a create function that I don't *think* needs to be there. I
> have a bunch of panels without create functions and I'm not getting errors
> for those controls. Any ideas on THIS? Can / how can I delete this create
> function without generating the error?

Since I'm assuming you're using GUIDE to create your GUI, change the
figure's CreateFcn property (using the Property Inspector) so it no longer
refers to the function, THEN delete the function.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: feval error message when opening a GUI

From: us

Date: 12 Jul, 2010 13:43:08

Message: 8 of 12

"John " <jfishbac@gmail.com> wrote in message <i1f43k$r05$1@fred.mathworks.com>...
> "Paul " <paul_tutzu@yahoo.com> wrote in message <i1f2ko$n7g$1@fred.mathworks.com>...
> > "John " <jfishbac@gmail.com> wrote in message <i1f1ol$qj5$1@fred.mathworks.com>...
> > > "Paul " <paul_tutzu@yahoo.com> wrote in message <i1evhv$4m2$1@fred.mathworks.com>...
> > > > "John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> > > > > % Hi!
> > > > >
> > > > > % I open up my GUI and get the following error:
> > > > >
> > > > > ??? Error using ==> feval
> > > > > Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
> > > > >
> > > > > Error in ==> gui_mainfcn at 96
> > > > > feval(varargin{:});
> > > > >
> > > > > Error in ==> DataGrabber_GUI at 42
> > > > > gui_mainfcn(gui_State, varargin{:});
> > > > >
> > > > > Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
> > > > >
> > > > >
> > > > > ??? Error using ==> struct2handle
> > > > > Error while evaluating figure CreateFcn
> > > > >
> > > > > % Any idea why this is happening and how to fix it?
> > > > >
> > > > > Thanks,
> > > > >
> > > > > JF
> > > >
> > > > This happens when the matlab cannot find the control (button, axes, radio button, label and so on) in the .fig file which has a function assigned in the .m file.
> > > >
> > > > If it is a figure, it is very probably that you change the name of the entire figure (main GUI window). Check the names and try to rename them in the right way.
> > >
> > > I looked through my file for any phantom controls (both visually and by using the Object Browser) and have not found anything I'm not expecting. The only things that don't have code are the uipanels. I did, however, delete some controls from my GUI recently and I'm pretty sure I was careful to delete the callbacks for all of these controls (it was after I deleted these controls that I started to see this error). Did I not dig far enough when deleting the callbacks?
> > >
> > > Thanks,
> > >
> > > JF
> >
> > I think I got it.
> >
> > The figure1 is the default tag for the GUI. You created the GUI window, created a CreateFcn function for the GUI when the tag of the window was figure1. After that you changed the name of the tag.
> >
> > So, go in the main GUI window, right-click, click on Property Inspector, search in the list for Tag and I can bet that the name is not 'figure1' anymore. You have more choices: change the name of the function to fit for the new Tag or delete the function if it contains no code (it will be automatically generated with the right name if you will ever need it in the future).
> >
> > Let me know if this was useful.
> >
> > Paul
> >
> > So click on the
>
> Paul,
>
> Thanks, I got rid of the error by RE-generating the createfcn for figure1. What I think ACTUALLY was going on was that at one time I generated a createfcn and then deleted it from the M-File. By putting the createfcn back in my GUI.m, I no longer get the error.
>
> BUT now i have a create function that I don't *think* needs to be there. I have a bunch of panels without create functions and I'm not getting errors for those controls. Any ideas on THIS? Can / how can I delete this create function without generating the error?
>
> Thanks,
>
> Thanks!

well...
remove the FIGURE's CREATEFCN property, then remove the M-file...

us

Subject: feval error message when opening a GUI

From: yang

Date: 10 Sep, 2010 01:36:23

Message: 9 of 12

"John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> % Hi!
>
> % I open up my GUI and get the following error:
>
> ??? Error using ==> feval
> Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> DataGrabber_GUI at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
>
>
> ??? Error using ==> struct2handle
> Error while evaluating figure CreateFcn
>
> % Any idea why this is happening and how to fix it?
>
> Thanks,
>
> JF

I had meet this question two times,butI forget how I dealed with it first time.
When I got this error message again,I copy the the corresponding callback to notebook .I got the queer code as below
r=FindNumberOfGroup([handles.y,handles.data]);
As you see behend the "r=FindNumberOfGroup([handles.y,handles.data])" exist the queer code.I don't know how those happend,but when I delete it ,the GUI works fine! Bye the way ,In m files those queer code can not see,but you can click beyond r=FindNumberOfGroup([handles.y,handles.data])
Wish it help!
Anything ,contact yangqianxu@dicp.ac.cn

Subject: feval error message when opening a GUI

From: yang

Date: 10 Sep, 2010 01:38:05

Message: 10 of 12

"John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> % Hi!
>
> % I open up my GUI and get the following error:
>
> ??? Error using ==> feval
> Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> DataGrabber_GUI at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
>
>
> ??? Error using ==> struct2handle
> Error while evaluating figure CreateFcn
>
> % Any idea why this is happening and how to fix it?
>
> Thanks,
>
> JF

I had meet this question two times,butI forget how I dealed with it first time.
When I got this error message again,I copy the the corresponding callback to notebook .I got the queer code as below
r=FindNumberOfGroup([handles.y,handles.data]);
As you see behend the "r=FindNumberOfGroup([handles.y,handles.data])" exist the queer code.I don't know how those happend,but when I delete it ,the GUI works fine! Bye the way ,In m files those queer code can not see,but you can click beyond r=FindNumberOfGroup([handles.y,handles.data])
Wish it help!
Anything ,contact yangqianxu@dicp.ac.cn

Subject: feval error message when opening a GUI

From: firedrich nietzsche

Date: 21 Jan, 2013 09:08:07

Message: 11 of 12

"John " <jfishbac@gmail.com> wrote in message <i1euhh$sgj$1@fred.mathworks.com>...
> % Hi!
>
> % I open up my GUI and get the following error:
>
> ??? Error using ==> feval
> Undefined function or method 'figure1_CreateFcn' for input arguments of type 'double'.
>
> Error in ==> gui_mainfcn at 96
> feval(varargin{:});
>
> Error in ==> DataGrabber_GUI at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Error in ==> guidemfile>@(hObject,eventdata)DataGrabber_GUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
>
>
> ??? Error using ==> struct2handle
> Error while evaluating figure CreateFcn
>
> % Any idea why this is happening and how to fix it?
>
> Thanks,
>
> JF

in my experience, you did not add the callback CreateFcn for GUI, if you add the the callback CreateFcn for GUI, this error will not happen

Subject: feval error message when opening a GUI

From: Iván

Date: 7 Aug, 2013 22:26:24

Message: 12 of 12

"Steven Lord" <slord@mathworks.com> wrote in message <i1f5cn$k1m$1@fred.mathworks.com>...
>
> "John " <jfishbac@gmail.com> wrote in message
> news:i1f43k$r05$1@fred.mathworks.com...
> > "Paul " <paul_tutzu@yahoo.com> wrote in message
> > <i1f2ko$n7g$1@fred.mathworks.com>...
> >> "John " <jfishbac@gmail.com> wrote in message
> >> <i1f1ol$qj5$1@fred.mathworks.com>...
> >> > "Paul " <paul_tutzu@yahoo.com> wrote in message
> >> > <i1evhv$4m2$1@fred.mathworks.com>...
> >> > > "John " <jfishbac@gmail.com> wrote in message
> >> > > <i1euhh$sgj$1@fred.mathworks.com>...
>
> *snip*
>
> > Paul,
> >
> > Thanks, I got rid of the error by RE-generating the createfcn for figure1.
> > What I think ACTUALLY was going on was that at one time I generated a
> > createfcn and then deleted it from the M-File. By putting the createfcn
> > back in my GUI.m, I no longer get the error.
> > BUT now i have a create function that I don't *think* needs to be there. I
> > have a bunch of panels without create functions and I'm not getting errors
> > for those controls. Any ideas on THIS? Can / how can I delete this create
> > function without generating the error?
>
> Since I'm assuming you're using GUIDE to create your GUI, change the
> figure's CreateFcn property (using the Property Inspector) so it no longer
> refers to the function, THEN delete the function.
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>


Thank you. Your method solved my problem.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us