how to set Matlab to show only fractions

Questions, discussions and tutorial about Matlab are posted here.

Moderator: ChangBroot

Forum rules
All of Question and tutorial about Matlab are posted here.

how to set Matlab to show only fractions

Postby barnamah » Sat 25 June, 2011 17:27

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   
Explore and know. That is asked.
User avatar
barnamah
 
Posts: 102
Joined: Mon 14 March, 2011 08:37
Location: Canada

Return to Matlab

Who is online

Users browsing this forum: No registered users and 1 guest

cron