comparison m-toolbox/classes/+utils/@prog/fields2list.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 function fnames = fields2list(fields)
2 % FIELDS2LIST splits a string containing fields seperated by ','
3 %
4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 %
6 % DESCRIPTION: FIELDS2LIST splits a string containing fields seperated by
7 % ',' and returns a cell array.
8 %
9 % CALL: fnames = fields2list(fields)
10 %
11 % INPUTS: string - a string seperated by ','
12 %
13 % OUTPUTS: fnames - cell array
14 %
15 % EXAMPLE: >> fields = 'field1, field2, field3, field4';
16 % >> ltpda_fields2list(fields)
17 % ans =
18 % 'field1' ' field2' ' field3' ' field4'
19 %
20 % VERSION: $Id: fields2list.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $
21 %
22 % HISTORY: 26-01-2007 M Hewitson
23 % Creation
24 %
25 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26
27 fnames = [];
28 [f,r] = strtok(fields, ',');
29 fnames = [fnames cellstr(f)];
30 while ~isempty(r)
31 [f,r] = strtok(r, ',');
32 fnames = [fnames cellstr(f)];
33 end
34
35
36 % END