フィルターのクリア

GUI keeps corrupting on exiting Matlab

4 ビュー (過去 30 日間)
Chuck Saunders
Chuck Saunders 2016 年 3 月 8 日
回答済み: Chuck Saunders 2016 年 5 月 27 日
I create a GUI with guide. I lay out figures, sliders, list boxes, etc. I edit the callbacks, get the functionality I want.
I save obsessively out of habit. Any time I make any change, I ctrl+s, run the program, see if the new code functions the way I want it to, etc. Everything works fine as long as Matlab is running.
Come lunch, a meeting, end of day, or at the end of a minor milestone in the development, I exit Matlab and commit everything in my Matlab folder with Git so I have a restore point. Every single time I start Matlab again, the GUI is corrupt.
By corrupt I mean:
  1. I start Matlab.
  2. I type 'guide' and press enter.
  3. I select my GUI from the "Recently Opened" selection.
  4. My GUI opens as though it were running - one window where I can actively edit the GUI, and another window where I cannot. The window where I cannot edit looks like it is running, but is not functional. (I'm assuming) none of the CreateFcn routines are executed, so none of the initializing handles are set. This gives me an error displayed in Matlab: Reference to non-existent field '<field that is set in the CreatFcn code>'.
  5. If I close the running GUI, then try to do ANYTHING with the editable GUI I get an error. For example, if I try to resize a slider, then I get the following error popup:
Error using handle.handle/get
Invalid or deleted object.
Error in guidefunc>localSetPixelPos (line 1969)
saveUnits = get(obj, 'units');
Error in guidefunc>moveGobject (line 2149)
localSetPixelPos(varargin{1}, varargin{4});
Error in guidefunc (line 67)
varargout = moveGobject(varargin{:});
[OK] [Go to error]
Anything that I do from this point on errors, and I can't save. All of the errors start with the same heading, "Error using handle.handle/get \n Invalid or deleted object." Also, at this point, any error in the GUI also spews errors in the command window:
java.lang.RuntimeException: Invalid or deleted object.
at com.mathworks.jmi.bean.UDDObject.get_from_Matlab(UDDObject.java:752)
at com.mathworks.jmi.bean.UDDObject.getPropertyValue(UDDObject.java:611)
at com.mathworks.toolbox.matlab.guide.HGControl.getPropertyValueForCompatibility(HGControl.java:249)
at com.mathworks.toolbox.matlab.guide.palette.MObjectProxy.updatePosition(MObjectProxy.java:277)
at com.mathworks.toolbox.matlab.guide.palette.MObjectProxy.updateProxy(MObjectProxy.java:241)
at com.mathworks.toolbox.matlab.guide.palette.GObjectProxy.updateProxy(GObjectProxy.java:396)
at com.mathworks.toolbox.matlab.guide.LayoutLooper$UpdateObjectWorker.runOnMatlabThread(LayoutLooper.java:865)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:79)
at com.mathworks.jmi.MatlabWorker.start(MatlabWorker.java:248)
at com.mathworks.toolbox.matlab.guide.LayoutLooper.updateObject(LayoutLooper.java:848)
at com.mathworks.toolbox.matlab.guide.LayoutArea.changeObjects(LayoutArea.java:3128)
at com.mathworks.toolbox.matlab.guide.LayoutArea$ObjectChanged.objectChanged(LayoutArea.java:3035)
at com.mathworks.services.ObjectRegistry.fireObjectRegistryEvent(ObjectRegistry.java:606)
at com.mathworks.services.ObjectRegistry.access$200(ObjectRegistry.java:20)
at com.mathworks.services.ObjectRegistry$MyBrowseableHandler.childChanged(ObjectRegistry.java:756)
at com.mathworks.services.ObjectRegistryEntry.fireBrowseableEvent(ObjectRegistryEntry.java:403)
at com.mathworks.services.ObjectRegistryEntry.changeChildren(ObjectRegistryEntry.java:206)
at com.mathworks.services.ObjectRegistryEntry.changeChild(ObjectRegistryEntry.java:198)
at com.mathworks.services.ObjectRegistry.change(ObjectRegistry.java:271)
at com.mathworks.services.ObjectRegistry.change(ObjectRegistry.java:242)
at com.mathworks.toolbox.matlab.guide.LayoutLooper$MoveCompleted.completed(LayoutLooper.java:555)
at com.mathworks.toolbox.matlab.guide.utils.LayoutWorker.runOnMatlabThread(LayoutWorker.java:55)
at com.mathworks.jmi.MatlabWorker$2.run(MatlabWorker.java:79)
at com.mathworks.jmi.NativeMatlab.dispatchMTRequests(NativeMatlab.java:475)
I am at a complete loss. Every time this happens I wind up re-drawing the entire GUI, resetting all of the tags, values, mins, and maxes. Then I right click on everything to get it to populate the callbacks, then I gut the auto-generated code and paste in the code I had originally written - the M file works fine, but the program doesn't run right unless I go to the GUI and force it to "create" the callbacks.
I was hoping to not have to come here to ask for help. I had R2013b, R2015a, and R2015b installed on the computer. I uninstalled all of the Matlab releases, rebooting after each, then reinstalled R2015b, then rebooted, and I still have the same problem. The only posts I can find online are circa 2008/2009 where people complain of their GUIs getting corrupt, and all of the responses appear to be, "It's fixed in R2008b," and they link http://www.mathworks.com/support/bugreports/452282 as the resolution. I followed the steps there but nothing resolved the problem. I did this before removing/reinstalling Matlab.
Here's what Matlab says I'm running:
>> ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.6.0.267246 (R2015b)
MATLAB License Number: XXXXXX
Operating System: Microsoft Windows 7 Professional Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.6 (R2015b)
Simulink Version 8.6 (R2015b)
Control System Toolbox Version 9.10 (R2015b)
Curve Fitting Toolbox Version 3.5.2 (R2015b)
MATLAB Compiler Version 6.1 (R2015b)
MATLAB Compiler SDK Version 6.1 (R2015b)
Optimization Toolbox Version 7.3 (R2015b)
SimMechanics Version 4.7 (R2015b)
SimPowerSystems Version 6.4 (R2015b)
Simscape Version 3.14 (R2015b)
Symbolic Math Toolbox Version 6.3 (R2015b)
System Identification Toolbox Version 9.3 (R2015b)
As far as I know, everything (Windows, Java, Matlab, etc.) are all up to date. I'm disheartened by the fact that it doesn't look like anyone else is having the same problem. If there's any other information that I can provide that would be of help, please let me know.
  2 件のコメント
Daniel Armyr
Daniel Armyr 2016 年 3 月 8 日
Just a random thought: Does your Git handle newlines properly? I am thinking that if it mangles the newlines, then the figure files could become corrupt.
Chuck Saunders
Chuck Saunders 2016 年 3 月 8 日
Git gives me a warning on the m file (not the figure) that line feeds (LF) will be replaced by carriage return line feeds (CRLF) in the m-file. However, it's supposed to leave the working directory (my local files) alone.

サインインしてコメントする。

採用された回答

Chuck Saunders
Chuck Saunders 2016 年 5 月 27 日
My solution was ultimately to ditch GUIDE and write my own UI from scratch. This takes a little more time to setup because the dimensions aren't as easy to manipulate. I found drawing it first on graph paper was the easiest for me - set your figure units to 'normalized' and then everything is just a scale from 0-1.
The only thing to remember here I suppose is that normalized units are a scale from 0-1 (0 to 100%) of the size of the parent object. For most of the UI controls this parent is the figure window, but on some (radio button groups were what gave me a hard time) the normalized units of the radio button is 0-100% of the size of the radio button frame.
Ditch GUIDE! It's not worth it. The initial GUI is easier to setup, but we are programmers - all of the work goes on behind the scenes, and when the GUI that you saved 5 minutes on gets corrupt, all the other work (that you spent days or weeks on) gets unusable. Learn to make the UI controls yourself.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by