how to set Matlab to show only fractions

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
0.0200
To get fraction only in Matlab use "format rats"
Now if you type 2/100 you will get 1/50
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