Why does ishghandle(0) alwys return true?
1 次查看(过去 30 天)
显示 更早的评论
Why does
ishghandle(0)
return true, even if there is no existent graphic object (actually, I executed this line of code first after Matlab startup).
0 个评论
采纳的回答
更多回答(1 个)
Georg Nestlinger
2021-1-26
4 个评论
Stephen23
2021-1-26
AFAIK, versions before R2014b used numeric (double) scalars as a kind of graphics object "handle" (really more like an ID number). My guess is that the functions that "check" the existence simply have a different behavior when applied to doubles (IDs) vs graphics object handles.
In the back of my head I recalled an earlier discussion on this topic, but I can't find it now.
Is it really required to test for the existence of the graphics object? Surely if you are the author of your GUI and you keep track of the objects (by storing them in arrays, etc.), then there is little need to "guess" what graphics objects might be hanging around.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!