Vahagn
Vahagn

Reputation: 4850

How to change MATLAB GUIDE figure callbacks file name?

MATLAB GUIDE is a utility for GUI programming in MATLAB.

If designing a figure named myfigure it creates two files myfigure.fig, which contains the GUI layout description, and myfigure.m which contains the callbacks describing the logic behind the GUI (e.g. when you click a button, a certain function is being called, and the .m file is intended to contain codes of such callback functions).

How can I change the name of myfigure.m to myfigure_callbacks.m and still have the functions in myfigure_callbacks.m bound with the GUI described at myfigure.fig?

So I want to have files named

myfigure.fig and myfigure_callbacks.m

instead of

myfigure.fig and myfigure.m

Upvotes: 3

Views: 4559

Answers (1)

gary
gary

Reputation: 4255

According to the documentation this cannot be done.

The code file and the FIG-file that define your GUI must have the same name. This name is also the name of your GUI.

Here's the documentation from Mathworks: Name a GUI and Its Files.


Edit: As you observed, renaming the GUI is intended to rename associated FIG and code files (automatically).

To rename a GUI, rename the GUI FIG-file using Save As from the Layout Editor File menu. When you do this, GUIDE renames both the FIG-file and the GUI code file, updates any callback properties that contain the old name to use the new name, and updates all instances of the file name in the body of the code.

Upvotes: 2

Related Questions