How can I convert a number into a text string for their corresponding word in english ?

I want to convert numbers into text strings for their corresponding words in english, for instance:
1---> 'one' ; 2 ---> 'two' ; 52 ---> 'fiftytwo' and so on
is there any functionality in matlab for this? Thanks in advance for any helpful answers : )

 Accepted Answer

Very easily using my FEX submission num2words:
Easy to use, plus options for customizing the format, case, scale, sig-figs, etc:
>> num2words(0)
ans = 'zero'
>> num2words(1024)
ans = 'one thousand and twenty-four'
>> num2words(-1024)
ans = 'negative one thousand and twenty-four'
>> num2words(1024, 'pos',true, 'case','title', 'hyphen',false)
ans = 'Positive One Thousand and Twenty Four'
>> num2words(1024, struct('type','ordinal', 'case','sentence'))
ans = 'One thousand and twenty-fourth'
>> num2words(1024, 'and',false, 'order',1) % round to the tens.
ans = 'one thousand twenty'

Asked:

on 5 Jun 2013

Answered:

on 7 Dec 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!