Use FINDALL:
allAxesInFigure = findall(figureHandle,'type','axes');
If you want to get all axes handles anywhere in Matlab, you could do the following:
allAxes = findall(0,'type','axes');
EDIT
To answer the second part of your question: You can test for whether a list of handles are axes by getting the handles type
property:
isAxes = strcmp('axes',get(listOfHandles,'type'));
isAxes
will be true for every handle that is of type axes
.
EDIT2
To select only axes handles that are not legends, you need to cleanup the list of axes (ax
handles by removing all handles whose tag is not 'legend'
or 'Colorbar'
:
axNoLegendsOrColorbars= ax(~ismember(get(ax,'Tag'),{'legend','Colobar'}))