function fhndls = dffirparse
%DFFIRPARSE  Parser for DFFIR filter objects.
%   FHNDLS = DFFIRPARSE returns a 3 element vector of function handles, 
%   FHNDLS, that point to the three functions required by DFILTPARSE
%   when called form any DFILT constructor.
%
%   For more information on what the 3 functions do, see the help for
%   DFILTPARSE.

%   Author(s): R. Losada
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.5 $  $Date: 2000/06/13 21:22:43 $ 

fhndls = [@dffirdefaultfilt,@formcelldffir,@checkdffir];

%----------------------------------------------------------------------------------
function coeffs = dffirdefaultfilt
%DFFIRDEFAULTFILT  Default filter to use in dffir objects.

coeffs = {{1}};

%-----------------------------------------------------------------------------------
function [coeffs,msg] = formcelldffir(varargin)
%FORMCELLDFFIR  Form cell array of coefficients of dffir object.

msg = '';

% Form cell of cells of coefficients: {{B1},{B2},...}
for n = 1:length(varargin),
    coeffs{n} = {varargin{n}};
end

%----------------------------------------------------------------------------------
function [c,msg] = checkdffir(c)
%CHECKDFFIR  Check if input argument is a cell of vectors.

msg = '';
b = c{1};

if isempty(b),
    b = 0;
end

if (prod(size(b)) ~= max(size(b))),
    msg = 'DFFIR FIR coefficients must be specified in a vector.';
    return
end

b = b(:).'; % Always store polynomial coeffs as a row

c = {b};

