Clear Filters
Clear Filters

convert decimal number to ratio

8 views (last 30 days)
Charly
Charly on 18 Jun 2014
Commented: Charly on 18 Jun 2014
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

Accepted Answer

Mischa Kim
Mischa Kim on 18 Jun 2014
Edited: Mischa Kim on 18 Jun 2014
Charly, use the rat command:
rat(1/2/3)
ans =
0 + 1/(6)
  1 Comment
Charly
Charly on 18 Jun 2014
Thank you, I didn't know this simple command before ;)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!