Error message when opening a figure
4 views (last 30 days)
Show older comments
Hi,
I'm trying to open a figure which returns the following error:
Error using ==> open at 163 Undefined function or variable "host"
Any ideas on how to access this figure?
Thanks,
0 Comments
Answers (1)
Massimo Ciacci
on 29 Sep 2017
Edited: Massimo Ciacci
on 29 Sep 2017
I had the same issue. And I found this. First I put a breakpoint in open.m line 155 (edit open.m to get there), try to open the figure again, and you end up there.
Upon executing line 158 alone :
feval(openAction,fullpath);
we get an insight on what is going on, an error fired by openfigLegacy at line 57, when calling a file which is not editable, hgload.p @ line 57, which fails to call hgloadStructDbl. In the command line you get this:
Undefined function or variable "host".
Error in graphics.datatip (line 21)
hAxes = ancestor(host,'axes');
Error in graphics.datacursormanager/createDatatip (line 22)
hDatatip = graphics.datatip(hTarget,...
Error in graphics.datacursormanager/deserializeDatatips (line 49)
tip = hThis.createDatatip(dataStruct(i).Target,dataStruct(i));
Error in hgloadStructDbl>figload_reset (line 382)
hDCM.deserializeDatatips;
Error in hgloadStructDbl (line 139)
figload_reset(hFigures(i));
Error in hgload (line 57)
Error in matlab.hg.internal.openfigLegacy (line 57)
[fig, savedvisible] = hgload(filename, struct('Visible','off'));
Error in openfig (line 37)
figOut = matlab.hg.internal.openfigLegacy(varargin{:});
So the fix I found by chance is to
(A) put another breakpoint in hgloadStructDbl.m line 139 (you need to find it by hand under toolbox\matlab\graphics\private\hgloadStructDbl.m)
(B) type return and end up there, @ a line with figload_reset(hFigures(i));
(C) Execute directly from the command line figload_reset(hFigures(i));
this will fire the error in the command line, but it solves our problem, since it won't fire in the next step.
(D) Now you can type return, the error will not fire.
The figure is now open.
0 Comments
See Also
Categories
Find more on Interactive Control and Callbacks 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!