view m-toolbox/classes/@ao/acos.m @ 13:e05504b18072
database-connection-manager
Move more functions to utils.repository
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05) |
parents |
f0afece42f48 |
children |
|
line source
% ACOS overloads the acos method for analysis objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: ACOS overloads the acos operator for analysis objects.
% Inverse cosine result in radians.
% ACOS(ao) is the arccosine of the elements of ao.data.
%
% CALL: ao_out = acos(ao_in);
% ao_out = acos(ao_in, pl);
% ao_out = acos(ao1, pl1, ao_vector, ao_matrix, pl2);
%
% <a href="matlab:utils.helper.displayMethodInfo('ao', 'acos')">Parameters Description</a>
%
% VERSION: $Id: acos.m,v 1.38 2011/04/19 18:48:11 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function varargout = acos(varargin)
% Check if the method was called by another method
callerIsMethod = utils.helper.callerIsMethod;
% Settings
operatorName = 'acos';
dxFcn = @(x,dx)abs(-1./(1 - x.^2).^(1/2)).*dx;
if callerIsMethod
in_names = {};
else
% Collect input variable names
in_names = cell(size(varargin));
for ii = 1:nargin,in_names{ii} = inputname(ii);end
end
copyObjects = nargout>0;
[bs, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
% Set units
if isa(bs, 'ao')
setUnitsForAxis(bs, pl, 'rad');
end
% set outputs
varargout = utils.helper.setoutputs(nargout, bs);
end
%--------------------------------------------------------------------------
% Get Info Object
%--------------------------------------------------------------------------
function ii = getInfo(varargin)
ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
end
%--------------------------------------------------------------------------
% Get Default Plist
%--------------------------------------------------------------------------
function plout = getDefaultPlist(set)
persistent pl;
persistent lastset;
if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set)
pl = buildplist(set);
lastset = set;
end
plout = pl;
end
function plout = buildplist(varargin)
plout = plist.getDefaultAxisPlist(varargin{:});
end