Error at open 163 again (trying to open a figure)

4 views (last 30 days)
Hey there!
I get a weird error. Before, I plotted a graph and saved the figure and afterwards, I could open it without any problems.
modeprob = figure;
save('mode_probabilities.fig','modeprob');
Since some time now, when I try to open these files, I get Error using ==> open at 163 on PC and Error using ==> open at 162 on Mac
I still can open the old files that I saved this way, but not any new files that I saved this way. If I save the figure by clicking 'save' through the GUI it works fine.
I am aware of this thread and I do not have anything new in the path. True, I did download some external toolboxes, but I removed them and I even restored the 'default' path. Now when I use which -all message
I get the same thing that the "best answer" guy got. I tried moving those four to the end but didn't help. Any ideas?
Thanks!

Accepted Answer

Sean de Wolski
Sean de Wolski on 28 Jun 2012
First, you're overwriting figure, don't know if that has anythign to with this, but it certainly isn't a good idea.
Second, I don't get why this should work, modeprob is the handle to the figure right? If so, then you're saving a handle to the figure that will no longer exist.
Third, I recommend using hgsave for this type of thing.
  4 Comments
Sean de Wolski
Sean de Wolski on 29 Jun 2012
Edited: Sean de Wolski on 29 Jun 2012
Glad to hear!
Sounds like your computer isn't going to get its desired weekend getaway!
Boris
Boris on 2 Jul 2012
Nope, it even had to work overnight! :)

Sign in to comment.

More Answers (1)

Riemanns world
Riemanns world on 19 Jul 2013
Thanks for pointing to hgsave. I was able to open a stubborn figure using hgload. Don't know if that would have worked in this situation.
I had a figure that wouldn't open and returned an error using using open (line 163). I tried to open it using the right click option "Open in GUIDE" and got both a series of command line errors (pasted below) and a dialog box of errors.
I was able to open the figure using hgload, and discovered that the figure somehow saved with two legends. I deleted one and can now open the file normally.
java.lang.ClassCastException: [D cannot be cast to [Ljava.lang.String;
at com.mathworks.toolbox.matlab.guide.LayoutEditor.completed(LayoutEditor.java:2218)
at com.mathworks.toolbox.matlab.guide.LayoutEditor$ReadFigureCompleted.completed(LayoutEditor.java:3049)
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.MatlabWorker.start(MatlabWorker.java:248)
at com.mathworks.toolbox.matlab.guide.utils.LayoutWorker.start(LayoutWorker.java:70)
at com.mathworks.toolbox.matlab.guide.utils.LayoutWorker.fevalConsoleOutput(LayoutWorker.java:41)
at com.mathworks.toolbox.matlab.guide.LayoutLooper.readFigure(LayoutLooper.java:712)
at com.mathworks.toolbox.matlab.guide.LayoutEditor.openLayoutEditor(LayoutEditor.java:2015)
at com.mathworks.toolbox.matlab.guide.LayoutEditor.openLayoutEditor(LayoutEditor.java:1978)
  1 Comment
Le Thi Khuyen
Le Thi Khuyen on 23 May 2016
I've tried to open a figure by using hgload, but in the command Window, it appears
Attempt to reference field of non-structure array.
Error in union (line 8) if g1.directed ~= g2.directed
Error in hgloadStructDbl>figload_reset (line 360) axlist = union(axlist,allChil);
Error in hgloadStructDbl (line 141) figload_reset(hFigures(i));
Error in C:\Program Files\MATLAB\R2012b\toolbox\matlab\graphics\hgload.p>hgload (line 68)
Could you tell me how can I do to troubleshoot this, please!

Sign in to comment.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!