function fnames = fields2list(fields)
% FIELDS2LIST splits a string containing fields seperated by ','
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: FIELDS2LIST splits a string containing fields seperated by
%              ',' and returns a cell array.
%
% CALL:       fnames = fields2list(fields)
%
% INPUTS:     string - a string seperated by ','
%
% OUTPUTS:    fnames - cell array
%
% EXAMPLE:    >> fields = 'field1, field2, field3, field4';
%             >> ltpda_fields2list(fields)
%             ans =
%                   'field1'    ' field2'    ' field3'    ' field4'
%
% VERSION: $Id: fields2list.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $
%
% HISTORY: 26-01-2007 M Hewitson
%             Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fnames = [];
[f,r] = strtok(fields, ',');
fnames = [fnames  cellstr(f)];
while ~isempty(r)
  [f,r] = strtok(r, ',');
  fnames = [fnames  cellstr(f)];
end


% END