Reputation: 5690
I have renamed a .fig
and associated .m
file generated by MATLAB's GUIDE. Having done this, I receive a long list of error messages including the following (just a sample of them shown below):
Undefined function or variable 'my_gui'.
Error in @(hObject,eventdata)my_gui('edit34_CreateFcn',hObject,eventdata,guidata(hObject))
Undefined function or variable 'my_gui'.
Error in @(hObject,eventdata)my_gui('edit33_CreateFcn',hObject,eventdata,guidata(hObject))
Undefined function or variable 'my_gui'.
Error in @(hObject,eventdata)my_gui('edit32_CreateFcn',hObject,eventdata,guidata(hObject))
These errors all seem to relate to individual items on my GUI, such as buttons, text boxes etc.
The function and .fig
file used to be called my_gui.m
and my_gui.fig
. However, I have sinced changed the name to my_new_gui.m
and my_new_gui.fig
(I've simplified the actual names for the purposes of this question).
So, the obvious solution is to go into the .m
file and replace all instances of my_gui
with my_new_gui
. However, I've done this, and the same error message appears. I have no idea where MATLAB is the reading text my_gui
from, since it doesn't exist in any of my code... Any help would be appreciated!
Edit I've discovered that these old references are written in the callbacks for each item on the GUI, which I can change by opening the Property Inspector for each individual item. However, I have a lot of items. If anyone can offer a solution to quickly edit these using a text editor, rather than clicking each individual one, I'd appreciate it!
Upvotes: 1
Views: 326
Reputation: 2342
Renaming MATLAB GUI should be done using Save As...
rather than manually changing the file names. Change the file names back to the original names and change the name using Save As...
option in GUIDE. This should automatically rename everything.
Upvotes: 0