Number to Words
Editor's Note: This file was selected as MATLAB Central Pick of the Week
- the output class: char or string.
- the number type selection: ordinal / decimal / cheque / money / highest magnitude.
- the number of significant digits or order-of-magnitude.
- upper / lower / title / sentence case.
- trailing zeros or without.
- the use of a comma between magnitude groups.
- the use of a hyphen between tens and ones.
- the use of 'and' before the tens/ones (required in British and Commonwealth English).
- a 'positive' prefix for non-negative values.
- the numbering scale: short / long / Indian / Peletier / Rowlett / yllion.
- currency unit names, e.g. Pound, Pence, Dollar, Cents, Rupees, etc.
- NUM2WORDS_TEST contains thousands of test cases.
- NUM2WORDS_DEMO compares the output of NUM2WORDS against real-world examples.
- NUM2WORDS_RAT converts a numeric to a string with an improper fraction in words.
Cite As
Stephen23 (2024). Number to Words (https://www.mathworks.com/matlabcentral/fileexchange/47221-number-to-words), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Language Fundamentals > Data Types > Dates and Time >
- MATLAB > Language Fundamentals > Data Types > Characters and Strings > String Parsing >
Tags
Acknowledgements
Inspired by: text2speech - tts, num2english, text-to-speech, Variable Precision Integer Arithmetic, Number to Scientific Prefix, Text2Speech for Matlab using unofficial google service, Date Vector/Number to ISO 8601 Date String, Customizable Natural-Order Sort, ISO 8601 Date String to Serial Date Number, Numeric to Ordinal-String, Natural-Order Row Sort, Natural-Order Filename Sort, Convert number to words, Words to Number
Inspired: Words to Number, Round to Electronic Component Values, Scientific Prefix to Number, Number to Scientific Prefix, Customizable Natural-Order Sort, Numeric to Ordinal-String, Natural-Order Row Sort, Natural-Order Filename Sort, Interactive Regular Expression Tool
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 | |
---|---|---|---|
4.1.4 | * Documentation improvements. |
||
4.1.3 | * FEX crashed while uploading the previous version... 2nd attempt. |
||
4.1.2 | * Add more testcases
|
||
4.1.1 | * option parsing improvements.
|
||
4.1.0 | * Faster option parsing.
|
||
4.0.1 | * Improve option parsing. |
||
4.0.0 | * Major code refactoring.
|
||
3.6.2 | * Update description. |
||
3.6.1 | * Revise title and summary |
||
3.6.0 | * Accepts string or char vector input arguments.
|
||
3.5.1 | * Add error IDs. |
||
3.5.0 | * Improve options handling. |
||
3.4.0.0 | * Check for cell array optional inputs. |
||
3.3.0.0 | * Include HTML _DOC file in zip.
|
||
3.2.0.0 | * Improve documentation.
|
||
3.1.0.0 | * Update license. |
||
3.0.0.0 | * Add 'india' number scale (lakh and crore).
|
||
2.2.0.0 | * Simplify cell array creation. |
||
2.1.0.0 | * Fix bug in myriad parsing (if >1 highest level multiplier).
|
||
2.0.0.0 | * Add a new <scale> option <myriad> (Knuth's -yllion).
|
||
1.9.0.0 | * More robust handling of some edge cases: zero, NaN, Inf.
|
||
1.8.0.0 | - Minor edit in blurb. |
||
1.7.0.0 | - Minor edit to FEX blurb. |
||
1.6.0.0 | * Add money/cheque number type.
|
||
1.5.0.0 | - I accidentally uploaded an older version. This version matches the online description :) |
||
1.4.0.0 | * comma control option.
|
|
|
1.3.0.0 | - Downloadable as toolbox |
|
|
1.2.0.0 | - Fix bug for ordinals 'first' and 'second'.
|
||
1.1.0.0 | - Improve decimal fraction handling.
|
||
1.0.0.0 |