function a = ylim2(arg1, arg2)
%YLIM Y limits.
% YL = YLIM gets the y limits of the current axes.
% YLIM([YMIN YMAX]) sets the y limits.
% YLMODE = YLIM('mode') gets the y limits mode.
% YLIM(mode) sets the y limits mode.
% (mode can be 'auto' or 'manual')
% YLIM(AX,...) uses axes AX instead of current axes.
%
% YLIM sets or gets the YLim or YLimMode property of an axes.
%
% See also PBASPECT, DASPECT, XLIM, ZLIM.
% Copyright 1984-2005 The MathWorks, Inc.
% $Revision: 1.7.4.2 $ $Date: 2005/10/28 15:53:29 $
if nargin == 0
a = get(gca,'ylim');
else
if isscalar(arg1) && ishandle(arg1) && strcmp(get(arg1, 'type'), 'axes')
ax = arg1;
if nargin==2
val = arg2;
else
a = get(ax,'ylim');
return
end
else
if nargin==2
error('MATLAB:ylim:InvalidNumberArguments', 'Wrong number of arguments')
else
ax = gca;
val = arg1;
end
end
if ischar(val)
if(strcmp(val,'mode'))
a = get(ax,'ylimmode');
else
set(ax,'ylimmode',val);
end
else
set(ax,'ylim',val);
ytik=[arg1(1):arg1(2)];
if arg1(2)-arg1(1)>20
ytik=[arg1(1)-1:4:arg1(2)];
ytik=[arg1(1) ytik(2:end)];
elseif arg1(2)-arg1(1)>10
ytik=[arg1(1)-1:2:arg1(2)];
ytik=[arg1(1) ytik(2:end)];
end
set(ax,'YTick',ytik);%,'FontWeight','demi'
end
end