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

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!

 Respuesta aceptada

Sean de Wolski
Sean de Wolski el 28 de Jun. de 2012

0 votos

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 comentarios

Boris
Boris el 28 de Jun. de 2012
Editada: Boris el 28 de Jun. de 2012
sorry, I meant modeprob = figure not the other way around.
I have never been good with the handles stuff, I admit. I always thought that the handle points to the object, so if I want to do something to the object, I use the handle... and it always worked. Just not anymore. I will check the hgsave command, thanks!
Boris
Boris el 29 de Jun. de 2012
Yep it works like a charm with hgsave. I don't know why it worked before, if it shouldn't have but doesn't matter. The only downside is that I have to redo the calculations for all the figures I cannot open, I guess, they cannot be saved.
Thank you!
Sean de Wolski
Sean de Wolski el 29 de Jun. de 2012
Editada: Sean de Wolski el 29 de Jun. de 2012
Glad to hear!
Sounds like your computer isn't going to get its desired weekend getaway!
Boris
Boris el 2 de Jul. de 2012
Nope, it even had to work overnight! :)

Iniciar sesión para comentar.

Más respuestas (1)

Riemanns world
Riemanns world el 19 de Jul. de 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 comentario

Le Thi Khuyen
Le Thi Khuyen el 23 de Mayo de 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!

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Jun. de 2012

Comentada:

el 23 de Mayo de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by