GUI error after saving as in another name

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

mohammad
mohammad 2012년 8월 8일
Is it possible the problem to be caused from another thing? and my thinking be wrong?
mohammad
mohammad 2012년 8월 10일
any idea?

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

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 8월 10일

1 개 추천

Did you resave the GUI from within GUIDE? You have to, you cannot just rename it in an explorer window.

댓글 수: 3

mohammad
mohammad 2012년 8월 10일
Thanks for reply. First I open "gui1.fig" in guide then from 'file' tab I select 'save as' and then save it in name of 'gui2'. Is this work wrong?
Sean de Wolski
Sean de Wolski 2012년 8월 10일
No. This is correct. I would repeat the process. Try again: rename btoh files to their original names in an identical directory. Then open the figure in GUIDE and "Save As" etc.
mohammad
mohammad 2012년 8월 10일
편집: mohammad 2012년 8월 10일
So great!!! Thanks This works properly. But for what and how do renaming and then 'save as' solve the problem?!

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

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 8월 10일

1 개 추천

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

mohammad
mohammad 2012년 8월 10일
Thanks, I did all of these but problem exist yet.
Image Analyst
Image Analyst 2012년 8월 10일
Well I do it all the time and it works. Are you telling me that you get an error that mentions gui1 when you're running gui2? If so, then gui1 must either be in the m-file somewhere, or in the properties (callback properties especially) of your gui controls in GUIDE.
Sean de Wolski
Sean de Wolski 2012년 8월 10일
I would guess the first attempt at renaming broke it. This would explain why unrenaming manually and then renaming in GUIDE would fix it...
mohammad
mohammad 2012년 8월 10일
OK, really thanks Sean so many thanks.

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

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by