Take the 2-minute tour ×

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.



share|improve this question
are you referring to this function: mathworks.com/matlabcentral/fileexchange/24447 ? –  Amro Oct 21 '11 at 4:14
yes, it is this one –  antony Oct 25 '11 at 8:08

1 Answer 1

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.

share|improve this answer

Your Answer


