Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: can't open gui
Date: Tue, 4 Nov 2008 13:27:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 93
Message-ID: <gepij5$m07$1@fred.mathworks.com>
References: <gepgp2$t87$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1225805221 22535 172.30.248.38 (4 Nov 2008 13:27:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 4 Nov 2008 13:27:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:498847


"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.