MATLAB: Convert decimal number to ratio

convert decimal 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

Best Answer

Charly, use the rat command:
rat(1/2/3)
ans =
0 + 1/(6)
Related Question