Error message when opening a figure

6 次查看(过去 30 天)
Mark
Mark 2012-1-23
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,

回答(1 个)

Massimo Ciacci
Massimo Ciacci 2017-9-29
编辑:Massimo Ciacci 2017-9-29
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.

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by