Mysterious GUI error messages

조회 수: 2 (최근 30일)
Jason
Jason 2012년 3월 2일
All you GUI experts -
I have built a GUI using GUIDE to perform all the function layouts (it's all buttons and text entry windows) and added the functionality I want in the function callbacks of the .m file. As I code improvements I tend to save the new GUI .m file under a new name so I can retain previous iterations of the GUI should I want to revisit them. The original file name was ClusterGUI, and I have gone through several iterations and the current one is ClusterGUI4. When I call ClusterGUI4 or initiate it from GUIDE, I get the following red lines of death:
??? Undefined function or method 'ClusterGUI' for input arguments of type 'char'.
Error in ==> @(hObject,eventdata)ClusterGUI('figure1_CreateFcn',hObject,eventdata,guidata(hObject))
??? Error using ==> struct2handle
Error while evaluating figure CreateFcn
The GUI runs anyway, but I've never been able to get rid of this.

채택된 답변

Walter Roberson
Walter Roberson 2012년 3월 2일
You need to go through the Property Inspector to find the Callback property that mentions ClusterGUI
You could probably also do it mechanically,
badcallbacks = findall(0,'-regexp','callback','ClusterGUI[^4]');
  댓글 수: 3
Jason
Jason 2012년 3월 2일
That fixed it! I found an old filename buried somewhere it shouldn't have been.
David (degtusmc)
David (degtusmc) 2013년 7월 11일
Walter,
I am having the exact same problem that Jason was having. I tried going through the Property Inspector, but I could not find anything referring to the old GUI.
When I tried the mechanical approach I get the following:
Warning: Regular expression comparison is not supported for the 'CallbackObject' property: using ordinary comparison.
> In C:\Program Files\MATLAB\R2011b\toolbox\matlab\graphics\private\findobjhelper.p>findobjhelper at 31
In findobj at 45
In C:\Program Files\MATLAB\R2011b\toolbox\matlab\graphics\findall.p>findall at 38
How do I interpret the result? Also, just to be clear; you are suppose to type the "findall" command in the command window under the folder where the GUI is located, right?
Thank you for your time.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Tigersnooze
Tigersnooze 2012년 3월 2일
This may be a dumb question, but are you also saving the new figure as 'ClusterGUI4.fig', or as applicable?
  댓글 수: 1
Jason
Jason 2012년 3월 2일
Not a dumb question at all, and yes I am. The name ClusterGUI does not appear anywhere in the newer ClusterGUI4 file - all instances of the name in the file itself are ClusterGUI4.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2012년 3월 2일
HOW did you save the new GUI? It's kind of particular how you do it. You can't just make copies in your operating system and rename them to the new name - never do that. It looks like you probably did this. The best way to create a new app based on an old one is to not to do anything in the operating system, and instead to open the original fig file in GUIDE and then do a "save as" your new app name ClusterGUI4.fig. This will then automatically create a ClusterGUI4.m file, and then all the obscure references in Property Inspector and the m file should be consistent and working fine.
  댓글 수: 4
Jason
Jason 2012년 3월 5일
Not sure what you'd call it, but when a brand-new figure is created in GUIDE, the first thing that appears is a grid upon which all other GUI elements are placed. That object still had the name of the first iteration of my GUI, and once that was renamed the annoying error message disappeared. In the object browser it's at the top of the list as figure(ClusterGUI4).
Image Analyst
Image Analyst 2012년 3월 5일
That is the actual figure itself, which is basically the background upon which you place all controls (such as axes, buttons, sliders, etc.). It has a "Name" property, which is what shows up in the title bar, and a "tag" property which is really the important property and is what it's called by when you look at the handles structure.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by