Converts a string into a floating point number. Use the format script command to change the precision of the output.
Syntax |
Description |
---|---|
out = str2num(string); |
Converts string into a number. |
Example
Convert a string into a number.
?str2num("1+2"); 3
Compare the output using almostequal .
?almostequal(str2num("1.5677"), 1.5677); result: 1
See Also
List of commands , " , + , ? , endl , write , format , findstring , replace , replacestring , substring , lower , upper , toscript , almostequal