Scientific Prefix to Number
- Automatically detects the prefix, or it may be restricted to either a name or symbol.
- Detects coefficients including +/- sign, decimal digits, and exponent E-notation.
- Detects zero or more coefficients in the string.
- Returns the parts of the input string that are split by the detected coefficients and prefixes.
- Returns the number of significant figures detected in the coefficients.
- Includes the prefixes added in November 2022: ronna, quetta, ronto, and quecto.
- parse negative strings (try '-1').
- parse E-notation values (try '1e0', '1e0 k', '1e30').
Cite As
Stephen23 (2024). Scientific Prefix to Number (https://www.mathworks.com/matlabcentral/fileexchange/53886-scientific-prefix-to-number), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Language Fundamentals > Data Types > Data Type Conversion >
- MATLAB > Language Fundamentals > Data Types > Characters and Strings > String Parsing >
Tags
Acknowledgements
Inspired by: num2eng, eng2num, num2eng, num2str with metric prefix, num2sci, sci2num, Customizable Natural-Order Sort, MetricPrefixStr - Print SI Prefix Formatted Numbers, Number to Words, Words to Number
Inspired: Round to Electronic Component Values, Custom List / Arbitrary Sequence Sort, Customizable Natural-Order Sort, Natural-Order Row Sort, Natural-Order Filename Sort
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
5.0.0 | * New options and option parsing.
|
||
4.1.5 | * update image. |
||
4.1.4 | * Documentation improvements.
|
||
4.1.3 | * Improve test function robustness. |
||
4.1.2 | * Correct SEE ALSO references. |
||
4.1.1 | * Update screenshot. |
||
4.1.0 | * Optimisations for code performance.
|
||
4.0.2 | * Add plenty of new testcases. |
||
4.0.1 | * Fix HTML table formatting. |
||
4.0.0 | * Accept string type inputs.
|
||
3.2.1 | * Add error IDs. |
||
3.2.0 | * Case-insensitive matching of INF and NaN (just like SSCANF etc).
|
||
3.1.3 | * More test cases.
|
||
3.1.2 | * Update documentation.
|
||
3.1.1 | * Improve documentation.
|
||
3.1.0 | * Parse micro characters U+00B5 & U+03BC.
|
||
3.0.1 | * Improve documentation. |
||
3.0.0.0 | * Simplify algorithm: faster! |
||
2.1.0.0 | * Change second input true/false to match NUM2SIP and NUM2BIP.
|
||
1.1.0.0 | * Update FEX examples. |
||
1.0.0.0 |