view m-toolbox/classes/@data3D/applyoperator.m @ 33:5e7477b94d94
database-connection-manager
Add known repositories list to LTPDAPreferences
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ − % APPLYOPERATOR applys the given operator to the two input data objects.
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ − %
+ − % DESCRIPTION: APPLYOPERATOR applys the given operator to the two input
+ − % 3D data objects.
+ − %
+ − % CALL: d = applyoperator(d1, d2, pl)
+ − %
+ − % INPUTS: d1 - a data3D object (xyzdata)
+ − % d2 - a data3D or cdata object
+ − % pl - a plist of configuration options
+ − %
+ − % PARAMETERS: 'op' - the operator to apply, e.g. 'power'
+ − %
+ − % VERSION: $Id: applyoperator.m,v 1.2 2011/02/18 16:48:52 ingo Exp $
+ − %
+ − %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ −
+ − function varargout = applyoperator(varargin)
+ −
+ − % Get the objects we have in the correct order
+ − objs = varargin(1:2);
+ −
+ − % Get the operator to apply
+ − op = varargin{3};
+ −
+ − if numel(objs) ~= 2
+ − error('### data3D/applyoperator requires two input data objects to work on.');
+ − end
+ −
+ − %--------------- Add some rules here.
+ − % cdata
+ − % 1) time-base must match
+ − % 2) y dimensions must match or one must be a single value
+ − %
+ −
+ − % TODO the rules don't seem to be properly applied here
+ −
+ − %%% Decide the type of the output object
+ − dout = objs{1};
+ −
+ − if isa(objs{2}, 'cdata')
+ − dout.z = feval(op, objs{1}.z, objs{2}.y);
+ − else
+ − dout.z = feval(op, objs{1}.z, objs{2}.z);
+ − end
+ −
+ − varargout{1} = dout;
+ − end
+ −