Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
big bug with GUIDE

Subject: big bug with GUIDE

From: mike

Date: 20 Jan, 2009 00:38:02

Message: 1 of 16

Hi,

I work with matlab R2008a, and I have encountered serious problem when I have tried to create a GUI using GUIDE.

Today, it is the third time that I got the following error:

?? 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 ==> Mike_Viewer3D_2 at 42
    gui_mainfcn(gui_State, varargin{:});

Each time, this error occur after matlab has crashed. Each time the ".fig" file could not be opened again and I had to start writing again the GUI from the beginning.
I am really frustrated and I do not know what to do.

I really need help,
Is there a way to recover, or at least open the corrupted ".fig" file in order to try to correct it?

Thank you in advance
 Mike

Subject: big bug with GUIDE

From: Matt Fig

Date: 20 Jan, 2009 01:30:05

Message: 2 of 16

I cannot help with what might very well be a bug, but I suggest you try writing your GUI without GUIDE. Problems like this are what persuaded me to stop using GUIDE. For an example of a GUI that doesn't use GUIDE (and isn't that hard to make!) see this:


http://www.mathworks.com/matlabcentral/fileexchange/22664




OiR_YiL^KZ$pX/UOVciSiRiL_YKY^SKRYiMW7ZMQKKpCKY^YXW`iiOKOVw*

Subject: big bug with GUIDE

From: cspsp

Date: 27 Jan, 2009 10:43:01

Message: 3 of 16

Hi.

Mike, have you found any way of recovering the fig file? I had a rather detailed GUI and would prefer not to have to build it all over again!
Does anyone know if we can manually edit anything in the file to fix it?

Thanks,
cspsp.

"mike" <mike.sumszyk@gmail.com> wrote in message <gl36da$6ih$1@fred.mathworks.com>...
> Hi,
>
> I work with matlab R2008a, and I have encountered serious problem when I have tried to create a GUI using GUIDE.
>
> Today, it is the third time that I got the following error:
>
> ?? 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 ==> Mike_Viewer3D_2 at 42
> gui_mainfcn(gui_State, varargin{:});
>
> Each time, this error occur after matlab has crashed. Each time the ".fig" file could not be opened again and I had to start writing again the GUI from the beginning.
> I am really frustrated and I do not know what to do.
>
> I really need help,
> Is there a way to recover, or at least open the corrupted ".fig" file in order to try to correct it?
>
> Thank you in advance
> Mike

Subject: big bug with GUIDE

From: David

Date: 27 Jan, 2009 11:02:03

Message: 4 of 16

"cspsp " <cspsp.generic@googlemail.com> wrote in message <glmofl$hhs$1@fred.mathworks.com>...
> Hi.
>
> Mike, have you found any way of recovering the fig file? I had a rather detailed GUI and would prefer not to have to build it all over again!
> Does anyone know if we can manually edit anything in the file to fix it?
>

it appears that at least in 7.0.4.365(r14) the fig file is really a mat file with a structure in it that has the uicontrols and other info. try copying it and rename to .mat and see if it will load. not sure what you could fix if it won't load, but if it does maybe you could find a bad control or something and delete just that one to recover.

Subject: big bug with GUIDE

From: Aurelien Queffurust

Date: 27 Jan, 2009 11:55:04

Message: 5 of 16

"mike" <mike.sumszyk@gmail.com> wrote in message <gl36da$6ih$1@fred.mathworks.com>...
> Hi,
>
> I work with matlab R2008a, and I have encountered serious problem when I have tried to create a GUI using GUIDE.
>
> Today, it is the third time that I got the following error:
>
> ?? Error using ==> hgload at 53
> invalid Figure file format
>


There is a bug report on this issue:
http://www.mathworks.com/support/bugreports/details.html?rp=452282
Its is fixed in 8b. In 8a you need to download a patch for guidemfile.m from the above URL link.

Aur?lien

Subject: big bug with GUIDE

From: Walter Roberson

Date: 27 Jan, 2009 16:35:30

Message: 6 of 16

mike wrote:
> Each time, this error occur after matlab has crashed. Each time the ".fig" file could not be
> opened again and I had to start writing again the GUI from the beginning.
> I am really frustrated and I do not know what to do.

I think under similar circumstances, I would adopt a strategy of taking backups
so that it would not be necessary to start over from the beginning.

--
.signature note: I am now avoiding replying to unclear or ambiguous postings.
Please review questions before posting them. Be specific. Use examples of what you mean,
of what you don't mean. Specify boundary conditions, and data classes and value
relationships -- what if we scrambled your data or used -Inf, NaN, or complex(rand,rand)?

Subject: big bug with GUIDE

From: Sergiy Yakovenko

Date: 28 Jan, 2009 21:38:29

Message: 7 of 16

I've had the same issue on 2008a. The downloaded patched guide refuses
to open .FIG file. In fact all other matlab GUIs cause errors in the
command window after the attempt. Does anybody know how to fix the FIG
file?

-Sergiy

Subject: big bug with GUIDE

From: Sergiy Yakovenko

Date: 28 Jan, 2009 22:00:13

Message: 8 of 16

Ok. I've tried something that was a long shot and it worked:
1. Rename File.FIG into File.MAT
2. Load it to the workspace (drag'n'drop).
3. Delete field hgS_070000.properties.WindowButtonDownFcn, which (I
suspected) contain incorrect reference to automatic function handle.
4. Then: >> save File.mat hgS_070000
5. Rename File.MAT into File.FIG.
That's it! I can't believe I am saying it, but MathWorks has screwed
up this time.

-Sergiy

Subject: big bug with GUIDE

From: Phil Goddard

Date: 29 Jan, 2009 16:17:02

Message: 9 of 16

There's no need to rename the file, just use the -mat flag when using load

>> load -mat myFigFile.fig
>> % edit the structure
>> save -mat myFigFile.fig

Phil.

Subject: big bug with GUIDE

From: David

Date: 29 Jan, 2009 17:45:03

Message: 10 of 16

Sergiy Yakovenko <sergiy.yakovenko@gmail.com> wrote in message <e538a250-1a99-4731-b6b1-2336da4ec876@r10g2000prf.googlegroups.com>...
> Ok. I've tried something that was a long shot and it worked:
> 1. Rename File.FIG into File.MAT
> 2. Load it to the workspace (drag'n'drop).
> 3. Delete field hgS_070000.properties.WindowButtonDownFcn, which (I
> suspected) contain incorrect reference to automatic function handle.
> 4. Then: >> save File.mat hgS_070000
> 5. Rename File.MAT into File.FIG.
> That's it! I can't believe I am saying it, but MathWorks has screwed
> up this time.
>
> -Sergiy

i guess my idea wasn't that far off after all.

Subject: big bug with GUIDE

From: Naresh Pai

Date: 12 Aug, 2009 00:34:02

Message: 11 of 16

"Phil Goddard" <philgoddardNOSPAM@telus.net> wrote in message <glskpu$htc$1@fred.mathworks.com>...
> There's no need to rename the file, just use the -mat flag when using load
>
> >> load -mat myFigFile.fig
> >> % edit the structure
> >> save -mat myFigFile.fig
>
> Phil.

Hi Phil and others,
       I am using Matlab 2008a and the GUI developed keeps getting corrupt. When I try to load using the command prompt nothing happens. If I rename to .mat and drop it in editor I see this:
MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Tue Aug 11 19:01:48 2009

Any suggestions ?

Naresh

Subject: big bug with GUIDE

From: Jan Simon

Date: 12 Aug, 2009 21:31:01

Message: 12 of 16

Dear Naresh Pai!

> > >> load -mat myFigFile.fig
> > >> % edit the structure
> > >> save -mat myFigFile.fig

> I am using Matlab 2008a and the GUI developed keeps getting corrupt.
> When I try to load using the command prompt nothing happens.

"Nothing" is less than I'd expect.
If you "load" the file, the contents is imported as variables in the work spaces. So "whos" should show you the imported data.
It is less confusing to import the data to a variable:
  FigData = load('myFigFile.fig', '-mat')

Good luck, Jan

Subject: big bug with GUIDE

From: Phil Goddard

Date: 12 Aug, 2009 22:21:03

Message: 13 of 16


> If you "load" the file, the contents is imported as variables in the work spaces. So "whos" should show you the imported data.
> It is less confusing to import the data to a variable:
> FigData = load('myFigFile.fig', '-mat')

A .fig file contains only one variable and it is already a structure, plus the name of the variable is the same as the one that needs to be used when saving the altered structure back into a .fig file, so I don't believe using the functional form of load gains anything.

On the saving end you do need to be careful in that the command I give will save all variables when in fact you only want to save the (altered) one that came from the .fig file.

Phil.

Subject: big bug with GUIDE

From: Jan Simon

Date: 12 Aug, 2009 23:42:18

Message: 14 of 16

Dera Phil Goddard!

> > > I am using Matlab 2008a and the GUI developed keeps getting corrupt.
> > > When I try to load using the command prompt nothing happens.

> > It is less confusing to import the data to a variable:
> > FigData = load('myFigFile.fig', '-mat')
>
> A .fig file contains only one variable and it is already a structure, plus the name of the variable is the same as the one that needs to be used when saving the altered structure back into a .fig file, so I don't believe using the functional form of load gains anything.

Naresh Pai said, that "nothing happens" after loading. This is obviously impossible, but the effects of LOAD are "not visible" without further knowledge.
You are right, the functional form does not "gain" anything, but at least Naresh Pai knows, where to look for the loaded data!

Good luck, Jan

Subject: big bug with GUIDE

From: Naresh Pai

Date: 12 Aug, 2009 23:52:04

Message: 15 of 16

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <h5vk0q$kcs$1@fred.mathworks.com>...
> Dera Phil Goddard!
>
> > > > I am using Matlab 2008a and the GUI developed keeps getting corrupt.
> > > > When I try to load using the command prompt nothing happens.
>
> > > It is less confusing to import the data to a variable:
> > > FigData = load('myFigFile.fig', '-mat')
> >
> > A .fig file contains only one variable and it is already a structure, plus the name of the variable is the same as the one that needs to be used when saving the altered structure back into a .fig file, so I don't believe using the functional form of load gains anything.
>
> Naresh Pai said, that "nothing happens" after loading. This is obviously impossible, but the effects of LOAD are "not visible" without further knowledge.
> You are right, the functional form does not "gain" anything, but at least Naresh Pai knows, where to look for the loaded data!
>
> Good luck, Jan

Phil and Jan,
   Thanks for your responses. I had to ultimately rebuild my GUI. Fortunately, I had a backed-up version, so did not have to start from scratch.

Naresh

Subject: big bug with GUIDE

From: Saurav

Date: 19 Aug, 2009 09:20:02

Message: 16 of 16

Hello All,
      I also experienced the same problem with corrupt GUI (line 53, hgload ... etc.). I had to rebuild the GUI. This is an accepted bug & available in Matlab buglist. However, the workaround mentioned there did not help.
      I was viewing the application from GUIDE using 'Run Figure' command of GUIDE and was also simultaneouls trying to run the application that invoked the GUI. Now I close save & close the GUI before running the application. The GUI did not get corrupted again. So, may be that, running the same GUI from GUIDE & in the application simultaneously is the cause.
      I am not sure how far my guess is true. Does anybody have any similar experience?
Rgds,
Saurav

"Naresh Pai" <npai@uark.edu> wrote in message <h5vkj4$r9k$1@fred.mathworks.com>...
> "Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <h5vk0q$kcs$1@fred.mathworks.com>...
> > Dera Phil Goddard!
> >
> > > > > I am using Matlab 2008a and the GUI developed keeps getting corrupt.
> > > > > When I try to load using the command prompt nothing happens.
> >
> > > > It is less confusing to import the data to a variable:
> > > > FigData = load('myFigFile.fig', '-mat')
> > >
> > > A .fig file contains only one variable and it is already a structure, plus the name of the variable is the same as the one that needs to be used when saving the altered structure back into a .fig file, so I don't believe using the functional form of load gains anything.
> >
> > Naresh Pai said, that "nothing happens" after loading. This is obviously impossible, but the effects of LOAD are "not visible" without further knowledge.
> > You are right, the functional form does not "gain" anything, but at least Naresh Pai knows, where to look for the loaded data!
> >
> > Good luck, Jan
>
> Phil and Jan,
> Thanks for your responses. I had to ultimately rebuild my GUI. Fortunately, I had a backed-up version, so did not have to start from scratch.
>
> Naresh

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us