view m-toolbox/classes/@ao/ge.m @ 38:3aef676a1b20 database-connection-manager

Keep backtrace on error
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% GE overloads >= operator for analysis objects. Compare the y-axis values.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: GE 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', 'ge')">Parameters Description</a>
%
% VERSION:     $Id: ge.m,v 1.26 2011/04/08 08:56:17 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = ge(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: ge.m,v 1.26 2011/04/08 08:56:17 hewitson Exp $', sets, pl);
  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