Code covered by the BSD License  

Highlights from
choose_profile_limits

image thumbnail
from choose_profile_limits by Kevin Bartlett
Allows user to choose limits of oceanographic profile (e.g., CTD cast)

ydir(varargin)
function [varargout] = ydir(varargin)
%
% ydir.m--Sets y-direction of current axes.
%
% YDIR by itself, toggles the y-direction.
%
% YDIR('REVERSE') sets the y-direction to reverse.
%
% YDIR('NORMAL') sets the y-direction to normal.
%
% DIRSTR = YDIR returns the current y-direction, without changing it.
% 
% Syntax: <dirStr> = ydir(<dirStr>)

% Developed in Matlab 7.0.1.24704 (R14) Service Pack 1 on GLNX86.
% Kevin Bartlett(kpb@uvic.ca), 2005/12/21, 16:42
%-------------------------------------------------------------------------

if nargin == 1
    doToggle = 0;
    dirStr = lower(varargin{1});
elseif nargin == 0 & nargout == 0
    doToggle = 1;
elseif nargin == 0 & nargout == 1
    doToggle = 0;
    dirStr = 'dummy';
else
    error([mfilename '.m--Incorrect number of input arguments.']);
end % if

if doToggle == 1

    origYdir = get(gca,'ydir');

    if strcmp(origYdir,'normal')
        set(gca,'ydir','reverse');
    else
        set(gca,'ydir','normal');
    end % if

else
        
    if strcmp(dirStr,'dummy')==0
        set(gca,'ydir',dirStr);
    end % if

end % if

if nargout == 1
    varargout{1} = get(gca,'ydir');
end % if

Contact us at files@mathworks.com