view m-toolbox/classes/+utils/@prog/fields2list.m @ 11:9174aadb93a5 database-connection-manager

Add LTPDA Repository utility functions into utils.repository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

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