开发者

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 l开发者_如何学运维ogic 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜