Modification to GUIDE corrupts FIG-file
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nicolas Martin
am 19 Apr. 2016
Kommentiert: Kristoffer Walker
am 2 Dez. 2019
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 Kommentar
Akzeptierte Antwort
Image Analyst
am 19 Apr. 2016
Like Walter said, restore from your back up. (You do have one right? If not, you've learned a good lesson.) Better yet, time to upgrade that 3 year old version to the latest version. Or else build a new GUI from scratch and just copy and paste callback function code/contents to the new one. Not too much trouble if there's not too many controls on the window.
1 Kommentar
Walter Roberson
am 19 Apr. 2016
When I was systems administrator, my bosses used to be... displeased... at how much I insisted be spent on backup hardware and software. "We've never had a big problem, so is it worth it?" Back in the days when a 2 gigabyte hard drive would the budget badly. There were a couple of times when Brion or I had to rebuild the research systems from tape after the RAID drives flaked out; it did not happen often, but when it did it was a nuisance rather than a disaster.
Weitere Antworten (3)
Baltam
am 19 Apr. 2016
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
0 Kommentare
nicolas thorne
am 11 Okt. 2016
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 Kommentare
Kristoffer Walker
am 2 Dez. 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.
Siehe auch
Kategorien
Mehr zu Whos finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!