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:
Problem in GUI design

Subject: Problem in GUI design

From: Ahmed Hussain

Date: 30 Jul, 2009 16:05:19

Message: 1 of 4

Dear All,

It happened with me several times that the MATLAB complier crashes as I try to run my GUI. It asks me to exit and restart MATLAB. Doing so and running my GUI (from .m file) again gives me 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 ==> Fig2_16 at 42
    gui_mainfcn(gui_State, varargin{:});

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


It also does not open the physical GUI. I dont know what is the problem. I have to redesign th GUI :(

Any help on this?

Thank you,

Ahmed H.

CTH - Sweden

Subject: Problem in GUI design

From: Dave Brackett

Date: 31 Jul, 2009 15:24:02

Message: 2 of 4

"Ahmed Hussain" <ahmedhussain85@yahoo.com> wrote in message <h4sgbv$6ts$1@fred.mathworks.com>...
> Dear All,
>
> It happened with me several times that the MATLAB complier crashes as I try to run my GUI. It asks me to exit and restart MATLAB. Doing so and running my GUI (from .m file) again gives me 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 ==> Fig2_16 at 42
> gui_mainfcn(gui_State, varargin{:});
>
> ??? 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 ==> Fig2_16 at 42
> gui_mainfcn(gui_State, varargin{:});
>
>
> It also does not open the physical GUI. I dont know what is the problem. I have to redesign th GUI :(
>
> Any help on this?
>
> Thank you,
>
> Ahmed H.
>
> CTH - Sweden

Problems like this seem to be quite common with Matlab GUIs, and I have experienced several myself, all of which I have not been able to recover. However, there is a known bug and depending on which version of Matlab you are using, may help you. Details of the workaround can be found here: http://www.mathworks.com/support/bugreports/452282

I recommend making very frequent backups of the .fig file especially. The .m file usually continues to work fine once the corrupted .fig file is replaced either with a backup or a recreated one.

Subject: Problem in GUI design

From: Santanu

Date: 5 Aug, 2009 20:03:04

Message: 3 of 4

I am facing a similar problem and the patch didn't solve it either. I found a solution in another forum which recommends to rename the fig file to mat file and open it , but I had no luck with that too , as its not opening. Does nayone know any other fix for this problem?


"Dave Brackett" <davebrackett@hotmail.com> wrote in message <h4v2ai$7uu$1@fred.mathworks.com>...
> "Ahmed Hussain" <ahmedhussain85@yahoo.com> wrote in message <h4sgbv$6ts$1@fred.mathworks.com>...
> > Dear All,
> >
> > It happened with me several times that the MATLAB complier crashes as I try to run my GUI. It asks me to exit and restart MATLAB. Doing so and running my GUI (from .m file) again gives me 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 ==> Fig2_16 at 42
> > gui_mainfcn(gui_State, varargin{:});
> >
> > ??? 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 ==> Fig2_16 at 42
> > gui_mainfcn(gui_State, varargin{:});
> >
> >
> > It also does not open the physical GUI. I dont know what is the problem. I have to redesign th GUI :(
> >
> > Any help on this?
> >
> > Thank you,
> >
> > Ahmed H.
> >
> > CTH - Sweden
>
> Problems like this seem to be quite common with Matlab GUIs, and I have experienced several myself, all of which I have not been able to recover. However, there is a known bug and depending on which version of Matlab you are using, may help you. Details of the workaround can be found here: http://www.mathworks.com/support/bugreports/452282
>
> I recommend making very frequent backups of the .fig file especially. The .m file usually continues to work fine once the corrupted .fig file is replaced either with a backup or a recreated one.

Subject: Problem in GUI design

From: Tortuka

Date: 21 Jun, 2010 13:50:32

Message: 4 of 4

i faced the same problem,

i think it happens, if you try to access the 'videoinput' variable from more than one .m file

try to access the 'videoinput' with only one file at a time, if by mistake you happen to open two different .m files, than just simply restart MATLAB, and make sure, you use 'videoinput' from sigle .m file

this way, it solved my problem, i hope it does your...

best of luck

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