MATLAB Answers

0

Question about fractional values.

Asked by Portgas Ace on 21 Sep 2012
Is there a way where i can separate a whole number from a fraction for example (5/3), is there a way to make it (5)(1/3)?

  1 Comment

Matt Fig
on 21 Sep 2012
Do you have strings or what?
S = '(5/3)' % Like this?

Sign in to comment.

Tags

1 Answer

Answer by Andrei Bobrov
on 21 Sep 2012

use Symbolic Math Toolbox
x = sym('5/3');
[N,D] = numden(x);
out = [N,1/D];

  1 Comment

solved my problem using [N,D] = rat(x). thanks though :D

Sign in to comment.