Function Reference
— Function File: [tok, rem] = strtok (str, delim)

Find all characters up to but not including the first character which is in the string delim. If rem is requested, it contains the remainder of the string, starting at the first deliminator. Leading delimiters are ignored. If delim is not specified, space is assumed.

Demonstration 1

The following code

 strtok("this is the life")
 % split at the first space, returning "this"

Produces the following output

ans = this

Demonstration 2

The following code

 s = "14*27+31"
 while 1
   [t,s] = strtok(s, "+-*/");
   printf("<%s>", t);
   if isempty(s), break; endif
   printf("<%s>", s(1));
 endwhile
 printf("\n");
 % ----------------------------------------------------
 % Demonstrates processing of an entire string split on
 % a variety of delimiters. Tokens and delimiters are 
 % printed one after another in angle brackets.  The
 % string is:

Produces the following output

s = 14*27+31
<14><*><27><+><31>