MATLAB: GUIDE gui compatibility between 2015b and 2009b

guider2009br2015b

I have been working on a gui tool using GUIDE in 2009b and it has been functional in that environment. After making a trivial geometry edit in 2015b, I was worried to find that while my gui worked flawlessly in 2015b, it no longer could be run or edited in 2009b, resulting in a pile of errors:
??? Error using ==> hgload at 53
invalid Figure file format
Error in ==> openfig at 72
[fig, savedvisible] = hgload(filename, struct('Visible','off'));
Error in ==> gui_mainfcn>local_openfig at 286
gui_hFigure = openfig(name, singleton, visible);
Error in ==> gui_mainfcn at 159
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
Error in ==> testgui at 42
gui_mainfcn(gui_State, varargin{:});
After doing a casual browse of the file contents and creating a test figure file, I notice that 2015b appends a hgM_070000 struct when any edits are made. Deleting this allows the gui to work in 2009b again.
I haven't yet found anything in documentation or bug reports about this. Is there a known incompatibility with older versions of Matlab, or is there something I can do to ensure compatibility beyond manually editing the file contents?
EDIT: After dredging the release notes, I see a long history of deprecated or altered functionality WRT gui development. With that in mind, I suppose it's probably expected that some things in particular are incompatible. The question still stands, though; this change to the file appears to break compatibility regardless of the gui content.
I'm wondering if it's even reasonable to bother using GUIDE as a crutch or if I'm better off just figuring out how to build everything programmatically. Alternatively, I suppose I could always just build the gui in 2009b and never ever touch it again for fear of making it error-bomb other users. If there's an intermediate choice, I'd be interested.

Best Answer

GUIDE has never been designed for backwards compatibility in what it generates.
In particular since R2014b it is likely to generate HG2 objects that cannot be read by older releases.
Related Question