matlab - Check if axes box is empty -


i'm trying compare 2 images using matlab. problem i'm getting result if there nothing in axes box. don't know how solve problem.

this error i'm gettingenter image description here

and output screen

enter image description here

any suggestions? in advance!

you can check number of elements returned findall, when pass axes handle:

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

out1 =       2   out2 =       1 

an empty axes object return 1, filled 1 at least 2.