function ylblalgn(fig)
%YLBLALIGN Align y axis labels.

%Modified 1997-06-21, Bjorn Wittenmark
if nargin==0
  fig = gcf;
end
ax = findobj(get(fig,'Children'),'flat','Type','axes');
nax = length(ax);
pos = zeros(nax,3);
for i=1:nax
  pos(i,:) = get(get(ax(i),'YLabel'),'Position');
end
[newpos,idx] = min(pos(:,1));
for i=1:nax
  set(get(ax(i),'YLabel'),'Position',[newpos,pos(i,2),pos(i,3)])
end
