Mercurial > hg > ltpda
diff m-toolbox/classes/@miir/setB.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@miir/setB.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,97 @@ +% SETB Set the property 'b' +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: SETB Set the property 'b' +% +% CALL: obj = obj.setB(12); +% obj = setB(obj, 12); +% +% INPUTS: obj - is a miir object +% +% <a href="matlab:utils.helper.displayMethodInfo('miir', 'setB')">Parameters Description</a> +% +% VERSION: $Id: setB.m,v 1.9 2011/04/08 08:56:33 hewitson Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function varargout = setB(varargin) + + % Check if this is a call from a class method + callerIsMethod = utils.helper.callerIsMethod; + + %%% Check if this is a call for parameters + if utils.helper.isinfocall(varargin{:}) + varargout{1} = getInfo(varargin{3}); + return + end + + obj = varargin{1}; + val = varargin{2}; + + %%% Check inputs + if numel(obj) > 1 + error('### This method supports only one input filter'); + end + + %%% If val is a plist-object then get the value out of the plist + if isa(val, 'plist') + val = find(val, 'b'); + end + + %%% decide whether we modify the miir-object, or create a new one. + obj = copy(obj, nargout); + + %%% set 'b' + obj.b = val; + + if ~callerIsMethod + obj.addHistory(getInfo('None'), plist('b', val), '', obj.hist); + end + + varargout{1} = obj; +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Local Functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FUNCTION: getInfo +% +% DESCRIPTION: 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: setB.m,v 1.9 2011/04/08 08:56:33 hewitson Exp $', sets, pl); +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% FUNCTION: getDefaultPlist +% +% DESCRIPTION: 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({'b', 'A set of denominator coefficients.'}, paramValue.EMPTY_DOUBLE); +end +