Matlab GUI 的管理按钮
我必须维护一个大型 MATLAB GUI,其中包含相当多的回调函数,每个回调函数都会在多个点被调用。在某个时刻,我决定重命名其中一个回调;为了不必通过 GUIDE 手动修改调用它的每个 UI,我使用了 excellent gencode
程序来“解开”.fig 文件,< code>s/old_name/new_name/g,然后重新创建 .fig。
这似乎工作得很好,除了一件事:当单击按钮组中的按钮时,我收到一条消息,告诉我函数 manageButtons
未知。经过一番谷歌搜索后,我发现 manageButtons
是 childAddedCbk
中的一个嵌套函数,我认为它是在创建 GUI 时由 GUIDE 调用的。现在,尝试仅将 manageButtons
移到其自己的路径内文件中也不起作用:传递给它的 hgroup
是一个无效句柄对象。
那么...有人有解决方法吗?以下任何内容都将受到赞赏:
- 以半自动方式更改 GUI 中的所有回调,或者
- 使
manageButtons
获得有效句柄,或者 - 使
gencode
不中断所有这些。
谢谢,
安东尼
I have to maintain a large MATLAB GUI, containing quite a few callback functions, each of which gets called at many points. At some point, I decided to rename one of the callbacks; in order not to have to go through GUIDE to manually modify each of the UI that calls it, I used the excellent gencode
program to "unwrap" the .fig file, s/old_name/new_name/g
, and recreate the .fig.
This seems to work well, except for one thing: when clicking on a button in a button group, I got a message telling me that the function manageButtons
is unknown. After a bit of googling, I find that manageButtons
is a nested function in childAddedCbk
, which, I assume, is called by GUIDE as the GUI is created. Now, trying to move just manageButtons
outside to its own, in-the-path file doesn't work either: the hgroup
passed to it is an invalid handle object
.
So... does anyone has a workaround for that? Any of the following will be appreciated:
- changing all the callbacks in a GUI in a semi-automatic way, or
- making the
manageButtons
get a valid handle, or - having
gencode
not break all that.
Thanks,
Antony
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将Fig + M 文件导出为单个.m 文件。您将无法使用指南对其进行编辑,但您将能够对生成的 .m 文件进行简单的正则表达式替换。
为此 - 使用 GUIDE 菜单 ->文件->出口。
You can export the FIG + M file to single .m file. You will lose the ability to edit this with guide, but you will be able to do a simple regular expression replace on the resulting .m file.
In order to do so - use on the menu of GUIDE -> File -> Export.