Home > chronux_1_50 > spikesort > tokenize.m

tokenize

PURPOSE ^

TOKENIZE Break string into tokens.

SYNOPSIS ^

function T = tokenize(S,D)

DESCRIPTION ^

TOKENIZE          Break string into tokens.
   T = TOKENIZE(S) returns a cell array T containing the tokens of S,
   delimited by white space.

   T = TOKENIZE(S,D) uses the characters of D as delimiters.

   Either syntax ignores any leading delimiters.

   Example:
      TOKENIZE('  The quick brown') gives {'The','quick','brown'}.
      TOKENIZE('1;20;300',';') gives {'1','20','300'}.

   See also STRTOK.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function T = tokenize(S,D)
0002 %TOKENIZE          Break string into tokens.
0003 %   T = TOKENIZE(S) returns a cell array T containing the tokens of S,
0004 %   delimited by white space.
0005 %
0006 %   T = TOKENIZE(S,D) uses the characters of D as delimiters.
0007 %
0008 %   Either syntax ignores any leading delimiters.
0009 %
0010 %   Example:
0011 %      TOKENIZE('  The quick brown') gives {'The','quick','brown'}.
0012 %      TOKENIZE('1;20;300',';') gives {'1','20','300'}.
0013 %
0014 %   See also STRTOK.
0015 
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%% Parse Inputs %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 if (nargin < 2), D = sprintf(' \t\r\n\f');  end;
0018 
0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%% Processing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0020 T = {};
0021 while (~isempty(S)),  [T{end+1},S] = strtok(S,D);   end

Generated on Mon 09-Oct-2006 00:54:52 by m2html © 2003