function varargout = limp(varargin)
% ------------------------------------------------------------------
% Display or modify current limits.
%
% SYNOPSIS:
%
%   str = limp(mode, vars)
%
% This is an interface to function `statlim()'. Limit and statistical
% arrays are taken from global variables LIM and STAT respectively. If
% output argument `str' is not specified, limit string is printed.
%
% If no input arguments are specified, current limits are returned.
%
% The limit string is stored in global variable LIMSTR.
%
% ------------------------------------------------------------------
%Time:<Last updated on 98/10/06 at 07:28:03 by veins@TORSK>
%File:<c:/codas3/gfi/matlab/matlab50/scan_bin/limp.m>

scanglob;

%--- Defaults:
mode = 1;
vars = [];
ii = 1:NVARS;
for i=ii,
  vars(i) = i;
end

%--- Arguments:
if nargin > 0,
  mode = varargin{1};
end
if nargin > 1,
  vars = varargin{2};
end

%--- Initialize limits:
if isempty(LIM),
  ii=1:NVARS;
  for i=ii,
	 LIM(i,:) = [ -Inf, +Inf, 0 ];
  end
end

%--- Call limits:
[LIM, LIMSTR] = statlim(mode, LIM, vars, STAT);

%--- Output arguments:
if nargout > 0,
  varargout{1} = LIMSTR;
else
  fprintf('%s', LIMSTR);
end

return;
