convert numbers to english words

22 visualizaciones (últimos 30 días)
David Davis
David Davis el 25 de Nov. de 2016
Editada: DGM el 6 de Mayo de 2023
I need to make a function that receives an integer input form the user and then gives a string output of the English conversion of the number.
Ex: num2word(14234) = "fourteen thousand two hundred and thirty four"
I've tried achieving this with loops and case structures as well as with arrays and there are a few issues that I keep running into.
1) However I do it; the way I approach it is above 150 lines
2) I always run into issues with cells. I try all the little nick nacks I know like cell fun but I still can't seem to get it to work.
what is the best way to approach this situation?
I've only used matlab for a short period of time so I don't know much more than the basics.

Respuestas (1)

KSSV
KSSV el 25 de Nov. de 2016
  3 comentarios
Atsushi Ueno
Atsushi Ueno el 6 de Mayo de 2023
check here please.
DGM
DGM el 6 de Mayo de 2023
Editada: DGM el 6 de Mayo de 2023
The examples given for num2words() work when tested in R2009b -- with exceptions that I doubt are an obstacle:
  1. explicitly requesting string output will return char output instead and a warning because the string class doesn't exist prior to R2016b
  2. operations on uint64 and int64 inputs don't work due to the absence of arithmetic support. That shouldnot be a problem for you, since that was added in R2010b.
So unless you're trying to use functionality that doesn't exist in your version, then you'll have to describe the problem. Without information, nobody can know how exactly it doesn't work or why it doesn't work.

Iniciar sesión para comentar.

Categorías

Más información sobre Argument Definitions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by