convert decimal number to ratio

Hello,
I would like to convert decimal number to ratios, when it is possible.
For example :
0.25 -> 1/4
1/2/3 -> 1/6
...
Some ideas ? Thank you

 Respuesta aceptada

Mischa Kim
Mischa Kim el 18 de Jun. de 2014
Editada: Mischa Kim el 18 de Jun. de 2014
Charly, use the rat command:
rat(1/2/3)
ans =
0 + 1/(6)

1 comentario

Charly
Charly el 18 de Jun. de 2014
Thank you, I didn't know this simple command before ;)

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 18 de Jun. de 2014

Comentada:

el 18 de Jun. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by