Page 1 of 1

how to set Matlab to show only fractions

PostPosted: Sat 25 June, 2011 17:27
by barnamah
How to set Matlab to show only fraction


Most of the time we need our result to be only fraction. For example if you divide 2 by 100 you will get 0.02

Code: Select all
>> 2/100

ans =

0.0200

To get fraction only in Matlab use "format rats"
Code: Select all
>> format rat


Now if you type 2/100 you will get 1/50
Code: Select all
>> 2/100

ans =

       1/50