MATLAB Function Reference | Search  Help Desk |
str2num | Examples See Also |
x = str2num('str
')
x = str2num('str
')
converts the string str
, which is an ASCII character representation of a numeric value, to MATLAB's numeric representation. The string can contain:
e
preceding a power of 10 scale factor
i
indicating a complex or imaginary number.
str2num
function can also convert string matrices.
str2num('3.14159e0')
is approximately .
To convert a string matrix:
str2num(['1 2';'3 4']) ans = 1 2 3 4
[]
(special characters)
Build arrays
;
(special characters) End array rows; suppress printing; separate statements.
hex2num
Hexadecimal to double number conversion
num2str
Number to string conversion
sparse
Create sparse matrix
sscanf
Read string under format control