Modification to GUIDE corrupts FIG-file

조회 수: 7 (최근 30일)
Nicolas Martin
Nicolas Martin 2016년 4월 19일
댓글: Kristoffer Walker 2019년 12월 2일
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!

채택된 답변

Image Analyst
Image Analyst 2016년 4월 19일
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
Walter Roberson
Walter Roberson 2016년 4월 19일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Baltam
Baltam 2016년 4월 19일
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
Nicolas Martin 2016년 4월 20일

Back up is love. Back up is life.

Luckily I had one not too old. But yes, I understood the importance to back up more often.

Thank you !


nicolas thorne
nicolas thorne 2016년 10월 11일
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
Steven Lord
Steven Lord 2016년 10월 11일
Have you tried out App Designer, introduced in release R2016a?
Kristoffer Walker
Kristoffer Walker 2019년 12월 2일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by