Contents Previous Next Subchapters

Converting a Character Matrix to a Numeric Matrix
Syntax str2num(s)
See Also num2str , atod , atoi

Description
Converts a character matrix to a numeric matrix. The elements of the result are specified and separated the same as an input array in Mlmode with the exception that the outside surrounding [ and ] need not be included in s.

Example
If in Mlmode you enter
     s = [ '1 2 3+i' ; '4+j 5 6' ]
     str2num(s)
O-Matrix will reply
     {
     [ (1,0) , (2,0) , (3,1) ]
     [ (4,1) , (5,0) , (6,0) ]
     }

Speed
This routine uses the eval function to enable compilation of expressions (such as 4+j in the example above). It therefore is much slower than the routine atod which does not allow as general a set of input formatting.