Matlab:检验有效句柄
使用 isgraphics 确定变量是否是有效的图形对象句柄。句柄变量(在本例中是 h)仍可存在,但如果其引用的对象已删除,则不是有效句柄。
h = plot(1:10);
...
close % Close the figure containing the plot
whos
Name Size Bytes Class Attributes
h 1x1 104 matlab.graphics.chart.primitive.Line
检验 h 的有效性:
isgraphics(h