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?
采纳的回答
更多回答(1 个)
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
2012-8-10
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
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
2012-8-10
类别
在 帮助中心 和 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!