检查轴箱是否为空

时间:2015-04-28 03:57:18

标签: matlab

我试图使用Matlab比较两个图像。问题是,即使 Axes框中没有任何内容,我也会得到结果。我不知道如何解决这个问题。

这是我得到enter image description here

的错误

这是我的输出屏幕

enter image description here

有什么建议吗? 提前谢谢!

1 个答案:

答案 0 :(得分:1)

当你传递轴句柄时,你可以检查findall返回的元素数量:

%// axes filled with plot
plot(1,1)
ax1 = gca;
out1 = numel(findall(ax1))

%// empty axes
axes
ax2 = gca;
out2 = numel(findall(ax2))
out1 =

     2


out2 =

     1

空轴对象将返回 1 ,填充至少为2

相关问题