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:
can't open gui

Subject: can't open gui

From: Leon Klein

Date: 4 Nov, 2008 12:56:02

Message: 1 of 3

While i was creating a GUI, it happend that i could no longer run it. Now i can only open the GUI's m-File. Could i have done anything wrong inside the code?

When i try to run the m-file i get the following error message:


??? Index exceeds matrix dimensions.

Error in ==> genvarname at 116
protectedAll = {varnameCell{:},protected{:}};

Error in ==> hgload at 92
    loadthis = genvarname(['hgload', fullpath]);

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



When i try to open an the GUI''s matlab figure (file -> open -> select figure) i get the following error message:


??? Index exceeds matrix dimensions.

Error in ==> cellstr at 28
            c{i} = deblank(s(i,:));

Error in ==> errordlg at 47
    ErrorString = cellstr(ErrorStringIn);

Error in ==> uiopen at 216
    errordlg(lasterr);





after trying this i even can't open guide (type guide in the command window):


??? Index exceeds matrix dimensions.

Error in ==> dialog at 85
hDialog = figure('BackingStore' ,backstore , ...

Error in ==> guidetemplate at 25
hDialog = dialog('Name', title,'visible','off','position',[0, 0, size.width,
size.height]);

Error in ==> guide at 69
        guidetemplate;

??? Index exceeds matrix dimensions.

Error in ==> cellstr at 28
            c{i} = deblank(s(i,:));

Error in ==> errordlg at 47
    ErrorString = cellstr(ErrorStringIn);

Error in ==> guidefunc>showErrorDialog at 3781
h = errordlg(message, title);

Error in ==> guidefunc at 152
    showErrorDialog('Unhandled internal error in guidefunc');

com.mathworks.jmi.MatlabException: Index exceeds matrix dimensions.
at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:211)
at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:121)
at com.mathworks.jmi.Matlab.mtFevalConsoleOutput(Matlab.java:1465)
at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:182)
at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:159)
at com.mathworks.toolbox.matlab.guide.utils.LayoutWorker.runOnMatlabThread(LayoutWorker.java:51)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:73)
at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:352)

Subject: can't open gui

From: Dave Brackett

Date: 4 Nov, 2008 13:27:01

Message: 2 of 3

"Leon Klein" <AnEinemTagMitLeon@gmx.de> wrote in message <gepgp2$t87$1@fred.mathworks.com>...
> While i was creating a GUI, it happend that i could no longer run it. Now i can only open the GUI's m-File. Could i have done anything wrong inside the code?
>
> When i try to run the m-file i get the following error message:
>
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> genvarname at 116
> protectedAll = {varnameCell{:},protected{:}};
>
> Error in ==> hgload at 92
> loadthis = genvarname(['hgload', fullpath]);
>
> 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 ==> guiAttitudeCalculator at 42
> gui_mainfcn(gui_State, varargin{:});
>
>
>
> When i try to open an the GUI''s matlab figure (file -> open -> select figure) i get the following error message:
>
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> cellstr at 28
> c{i} = deblank(s(i,:));
>
> Error in ==> errordlg at 47
> ErrorString = cellstr(ErrorStringIn);
>
> Error in ==> uiopen at 216
> errordlg(lasterr);
>
>
>
>
>
> after trying this i even can't open guide (type guide in the command window):
>
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> dialog at 85
> hDialog = figure('BackingStore' ,backstore , ...
>
> Error in ==> guidetemplate at 25
> hDialog = dialog('Name', title,'visible','off','position',[0, 0, size.width,
> size.height]);
>
> Error in ==> guide at 69
> guidetemplate;
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> cellstr at 28
> c{i} = deblank(s(i,:));
>
> Error in ==> errordlg at 47
> ErrorString = cellstr(ErrorStringIn);
>
> Error in ==> guidefunc>showErrorDialog at 3781
> h = errordlg(message, title);
>
> Error in ==> guidefunc at 152
> showErrorDialog('Unhandled internal error in guidefunc');
>
> com.mathworks.jmi.MatlabException: Index exceeds matrix dimensions.
> at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
> at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:211)
> at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:121)
> at com.mathworks.jmi.Matlab.mtFevalConsoleOutput(Matlab.java:1465)
> at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:182)
> at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:159)
> at com.mathworks.toolbox.matlab.guide.utils.LayoutWorker.runOnMatlabThread(LayoutWorker.java:51)
> at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:73)
> at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:352)


I too have had trouble with GUIs sometimes after changing something incorrectly and a similar java error appearing. I have found that the only thing you can do is recreate the GUI figure from scratch (or last backup), and regenerate the .m file.

Because you still have your .m file it does not actually take that long, depending on how complex your GUI figure is.

I now take very regular backups of any GUI I am creating. I would be keen to learn though how to force open a problematic GUI figure, so hopefully someone can help.

Subject: can't open gui

From: Andrzej Fiedler

Date: 23 Jan, 2009 18:20:18

Message: 3 of 3

"Leon Klein" <AnEinemTagMitLeon@gmx.de> wrote in message <gepgp2$t87$1@fred.mathworks.com>...
> While i was creating a GUI, it happend that i could no longer run it. Now i can only open the GUI's m-File. Could i have done anything wrong inside the code?
>
> When i try to run the m-file i get the following error message:
>
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> genvarname at 116
> protectedAll = {varnameCell{:},protected{:}};
>
> Error in ==> hgload at 92
> loadthis = genvarname(['hgload', fullpath]);
>
> 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 ==> guiAttitudeCalculator at 42
> gui_mainfcn(gui_State, varargin{:});
>
>
>
> When i try to open an the GUI''s matlab figure (file -> open -> select figure) i get the following error message:
>
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> cellstr at 28
> c{i} = deblank(s(i,:));
>
> Error in ==> errordlg at 47
> ErrorString = cellstr(ErrorStringIn);
>
> Error in ==> uiopen at 216
> errordlg(lasterr);
>
>
>
>
>
> after trying this i even can't open guide (type guide in the command window):
>
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> dialog at 85
> hDialog = figure('BackingStore' ,backstore , ...
>
> Error in ==> guidetemplate at 25
> hDialog = dialog('Name', title,'visible','off','position',[0, 0, size.width,
> size.height]);
>
> Error in ==> guide at 69
> guidetemplate;
>
> ??? Index exceeds matrix dimensions.
>
> Error in ==> cellstr at 28
> c{i} = deblank(s(i,:));
>
> Error in ==> errordlg at 47
> ErrorString = cellstr(ErrorStringIn);
>
> Error in ==> guidefunc>showErrorDialog at 3781
> h = errordlg(message, title);
>
> Error in ==> guidefunc at 152
> showErrorDialog('Unhandled internal error in guidefunc');
>
> com.mathworks.jmi.MatlabException: Index exceeds matrix dimensions.
> at com.mathworks.jmi.NativeMatlab.SendMatlabMessage(Native Method)
> at com.mathworks.jmi.NativeMatlab.sendMatlabMessage(NativeMatlab.java:211)
> at com.mathworks.jmi.MatlabLooper.sendMatlabMessage(MatlabLooper.java:121)
> at com.mathworks.jmi.Matlab.mtFevalConsoleOutput(Matlab.java:1465)
> at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:182)
> at com.mathworks.jmi.MatlabWorker.feval(MatlabWorker.java:159)
> at com.mathworks.toolbox.matlab.guide.utils.LayoutWorker.runOnMatlabThread(LayoutWorker.java:51)
> at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:73)
> at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:352)


Hey Leon,

I was having trouble opening up GUIs that I created in guide as well, and getting all sorts of errors. What I noticed was that I had modified a CreateFcn the *.m file for the GUI so that it would get variables from another GUI (this particular gui that I was trying to open was a sub gui, and I edited the code in the CreateFcn for a popupmenu).

This code, in the CreateFcn was the culprit. I guess when guide was trying to open the *.fig, it reads the *.m file and gets confused when it sees a call in a CreateFcn to another GUI. Anyways, I just commented the code (NOT the entire CreateFcn) and it opened up just fine!

Hope that helps,

Andrzej

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