view m-toolbox/classes/@miir/fromStandard.m @ 24:056f8e1e995e database-connection-manager

Properly record history in fromRepository constructors
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% Construct an miir from a standard types
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FUNCTION:    fromStandard
%
% DESCRIPTION: Construct an miir from a standard types
%
% CALL:        f = fromStandard(f, pli)
%
% PARAMETER:   type:     String with filter type description
%              pli:       Parameter list object
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function f = fromStandard(f, pli)
  
  VERSION = '$Id: fromStandard.m,v 1.16 2011/08/15 11:22:27 hewitson Exp $';
  
  ii = miir.getInfo('miir', 'From Standard Type');
  % Set the method version string in the minfo object
  ii.setMversion([VERSION '-->' ii.mversion]);
  
  % Add default values
  pl = applyDefaults(ii.plists, pli);
  
  % Get parameters
  type = find(pl, 'type');
  
  % check and fill parameter list
  plo = miir.parseFilterParams(pl);
  switch lower(type)
    case {'lowpass', 'low-pass', 'low pass'}
      f = mklowpass(f, plo);
    case {'highpass' 'high-pass', 'high pass'}
      f = mkhighpass(f, plo);
    case {'bandpass', 'band-pass', 'band pass'}
      f = mkbandpass(f, plo);
    case {'bandreject', 'band-reject', 'band reject'}
      f = mkbandreject(f, plo);
    otherwise
      error('### unknown standard filter type in miir constructor.');
  end
  
  if isempty(pl.find('name'))
    pl.pset('name', type);
  end
  
  % Add history
  f.addHistory(ii, pl, [], []);
  
  % Set object properties
  f.setObjectProperties(pl);
  
end % function f = miirFromStandardType(type, pli, version, algoname)