As a more general solution based on @Luis Mendo's answer, use findobjto get the axes. This will avoid all children of the parent figure, which may include elements without axial elements:
set( findobj( gcf, 'Type', 'axes' ), 'XTick', [], 'YTick', [] );
source
share