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

 採用された回答

Mischa Kim
Mischa Kim 2014 年 6 月 18 日
編集済み: Mischa Kim 2014 年 6 月 18 日

0 投票

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

1 件のコメント

Charly
Charly 2014 年 6 月 18 日
Thank you, I didn't know this simple command before ;)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

質問済み:

2014 年 6 月 18 日

コメント済み:

2014 年 6 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by