Info

此问题已关闭。 请重新打开它进行编辑或回答。

Question about fractional values.

1 次查看(过去 30 天)
Portgas Ace
Portgas Ace 2012-9-21
关闭: MATLAB Answer Bot 2021-8-20
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 个)

Andrei Bobrov
Andrei Bobrov 2012-9-21
use Symbolic Math Toolbox
x = sym('5/3');
[N,D] = numden(x);
out = [N,1/D];
  1 个评论
Portgas Ace
Portgas Ace 2012-9-21
solved my problem using [N,D] = rat(x). thanks though :D

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by