Mercurial > hg > ltpda
view m-toolbox/classes/@ao/setXunits.m @ 44:409a22968d5e default
Add unit tests
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 18:42:11 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% SETXUNITS sets the 'xunits' property of the ao. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: SETXUNITS sets the 'xunits' property of the ao. % % CALL: objs.setXunits(val); % objs.setXunits(val1, val2); % objs.setXunits(plist('xunits', val)); % objs = objs.setXunits(val); % % INPUTS: objs: Can be a vector, matrix, list, or a mix of them. % val: % 1. Single string e.g. 'Hz' % Each AO in objs get this value. % 2. Single string in a cell-array e.g. {'Hz'} % Each AO in objs get this value. % 3. cell-array with the same number of strings as in objs % e.g. {'Hz', 'V', 's'} and 3 AOs in objs % Each AO in objs get its corresponding value from the % cell-array % % <a href="matlab:utils.helper.displayMethodInfo('ao', 'setXunits')">Parameters Description</a> % % VERSION: $Id: setXunits.m,v 1.28 2011/09/16 05:03:21 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = setXunits(varargin) % Check if this is a call from a class method callerIsMethod = utils.helper.callerIsMethod; 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 objects = setPropertyValue(... varargin{:}, ... in_names, ... callerIsMethod, ... 'xunits', ... @setterFcn, ... nargout, ... @getInfo); % set outputs varargout = utils.helper.setoutputs(nargout, objects); end % Setter function to set the xunits function value = setterFcn(varargin) if nargin < 3 error('Please provide a value for the ''xunits'' property'); end obj = varargin{1}; pl = varargin{2}; value = varargin{3}; obj.data.setXunits(value); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Local Functions % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %-------------------------------------------------------------------------- % 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, mfilename('class'), 'ltpda', utils.const.categories.helper, '$Id: setXunits.m,v 1.28 2011/09/16 05:03:21 hewitson Exp $', sets, pl); end %-------------------------------------------------------------------------- % Get Default Plist %-------------------------------------------------------------------------- function plout = getDefaultPlist() persistent pl; if ~exist('pl', 'var') || isempty(pl) pl = buildplist(); end plout = pl; end function pl = buildplist() pl = plist({'xunits', 'The unit to set.'}, paramValue.EMPTY_STRING); end