view m-toolbox/classes/@ao/gt.m @ 36:5eb86f6881ef database-connection-manager

Remove commented-out code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% GT overloads > operator for analysis objects. Compare the y-axis values.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: GT overloads > operator for analysis objects.
%              Compare the y-axis values.
%
% CALL:        a = b>c;
%
% INPUTS:      b - Analysis object
%              c - Analysis object Or a number
%
% OUTPUTS:     a - vector of logical values from the comparison.
%
% <a href="matlab:utils.helper.displayMethodInfo('ao', 'gt')">Parameters Description</a>
%
% VERSION:     $Id: gt.m,v 1.23 2011/04/08 08:56:12 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = gt(varargin)

  % Check if this is a call for parameters
  if utils.helper.isinfocall(varargin{:})
    varargout{1} = getInfo(varargin{3});
    return
  end

  % Collect input variable names
  in_names = cell(size(varargin));
  for ii = 1:nargin,in_names{ii} = inputname(ii);end
  
  [pl, plvars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names);

  if ~(numel(rest) == 2 && ...
      ((isa(rest{1}, 'ao') && isa(rest{2}, 'ao')) || ...
      (isa(rest{1}, 'ao') && isnumeric(rest{2}))))
    error('### comparisons only between analysis objects and/or numbers.')
  end

  x = rest{1}.data.getY;

  if isa(rest{2}, 'ao')
    y = rest{2}.data.getY;
  else
    y = rest{2}*ones(size(x));
  end

  a = x > y;

  % Set output
  varargout{1} = a;
end
%--------------------------------------------------------------------------
% Get Info Object
%--------------------------------------------------------------------------
function ii = getInfo(varargin)
  if nargin == 1 && strcmpi(varargin{1}, 'None')
    sets = {};
    pl   = [];
  else
    sets = {'Default'};
    pl   = getDefaultPlist;
  end
  % Build info object
  ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.relop, '$Id: gt.m,v 1.23 2011/04/08 08:56:12 hewitson Exp $', sets, pl);
  ii.setModifier(false);
  ii.setArgsmin(2);
end
%--------------------------------------------------------------------------
% Get Default Plist
%--------------------------------------------------------------------------
function plout = getDefaultPlist()
  persistent pl;  
  if exist('pl', 'var')==0 || isempty(pl)
    pl = buildplist();
  end
  plout = pl;  
end

function pl = buildplist()
  pl = plist.EMPTY_PLIST;
end