Modification to GUIDE corrupts FIG-file
Show older comments
Hello,
I used GUIDE for creating a GUI and I have been using the program for 2 months and it always worked fine.
Now suddenly I get the following error message when trying to open the figure in GUIDE or trying to run the program:
Unable to read MAT-file
mydirectory/myfig.fig
File may be corrupt.
Error in graphics.internal.figfile.FigFile/read (line 25)
hgDataVars = load(filename, '-mat', '-regexp', '^hg[SO]');
Error in graphics.internal.figfile.FigFile (line 98)
obj.read(file);
Error in matlabroot\toolbox\matlab\graphics\hgload.p>hgload (line 59)
Error in openfig (line 72)
[fig, savedvisible] = hgload(filename, struct('Visible','off'));
Error in gui_mainfcn>local_openfig (line 286)
gui_hFigure = openfig(name, singleton, visible);
Error in gui_mainfcn (line 159)
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);
Error in myfig (line 42)
gui_mainfcn(gui_State, varargin{:});
All I changed today was adding a 'save' button in the toolbar with "tools->toolbar editor". I can't even try if that caused the problem by undoing it because, as I mentioned above, I can't open the figure in GUIDE.
It would be very nice if anyone could help me.
I am using MATLAB R2013a on Windows 8.
Thank you!
1 Comment
Walter Roberson
on 19 Apr 2016
Time to restore from backup.
Accepted Answer
More Answers (3)
Baltam
on 19 Apr 2016
0 votes
I'm no expert. But I had lots of troubles with the GUIfigs and I just downloaded a matlab 'b'-version and the problems stopped.
Kind regards,
Baltam
Nicolas Martin
on 20 Apr 2016
0 votes
nicolas thorne
on 11 Oct 2016
0 votes
I know this isn't helpful but Matlab needs to find a better way of allowing it's users to make GUI's, my GUIDE files are constantly getting corrupted, although I'm sure there is a good reason for it I can't seem to find information on how to fix it or on how to avoid it.
2 Comments
Steven Lord
on 11 Oct 2016
Kristoffer Walker
on 2 Dec 2019
One way to corrupt *.fig files is to do a partial save accidentally by trying to save your *.fig file while open in GUIDE while the Matlab session is in the middle of a debugging session (where you are paused at one step in the code). This just happened to me. One also needs to be patient when moving around many objects that are selected by the mouse at one time--if you are not patient and try to close or save prematurely, you may find yourself corrupting the *.fig file.
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!