GUI error after saving as in another name

4 views (last 30 days)
I have a GUI in name of 'gui1'. I saved it as 'gui2'. So, 'gui2.m' and 'gui2.fig' have been make. Now, when I run 'gui2.fig', it errors:
??? Error using ==> struct2handle
Undefined function or method 'gui1' for input arguments of type 'char'.
??? Error using ==> struct2handle
Error while evaluating uicontrol CreateFcn
I think when saving as 'gui2', callbacks of some objects (gui elements like push-button,...) remain on 'gui1'. There are too many elements (push-buttons,...) in GUI that I can't change callback of all of them one by one.
Is there any way for setting all objects callback to 'gui2' entirely?
  2 Comments

Sign in to comment.

Accepted Answer

Sean de Wolski
Sean de Wolski on 10 Aug 2012
Did you resave the GUI from within GUIDE? You have to, you cannot just rename it in an explorer window.
  3 Comments
mohammad
mohammad on 10 Aug 2012
So great!!! Thanks This works properly. But for what and how do renaming and then 'save as' solve the problem?!

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 10 Aug 2012
It's possible that if you changed something in the GUI manually, like you added a layout function or something, that there is a gui1 in a string somewhere that doesn't get changed when you save it as gui2. After you save it, open gui2.m in the editor and use the search and replace utility to change all gui1 to gui2 in the m-file and then try it.
  4 Comments
mohammad
mohammad on 10 Aug 2012
OK, really thanks Sean so many thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by