FUNCTION REFERENCE
str2num
Convert text holding numbers to a numeric array.
Convert text holding numbers to a numeric array.
Syntax
X = str2num(str)Syntax
[X, ok] = str2num(str)str holds numbers in matrix syntax, such as '1 2 3' or '[1 2; 3 4]'. The
rows of a character matrix are the rows of X. true/false give a logical
result. ok is false and X is [] when the text cannot be converted.
Example
str2num('[1 2; 3 4]') % [1 2; 3 4]Differences from MATLAB: the text is not evaluated as code. Only numbers,
true, false, Inf, NaN, pi, eps, i and j, the operators + - * / ^ .* ./ .^,
transposes and colon ranges are accepted; anything else, such as a function
call or a variable name, gives [] and ok = false.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.