how to calculate %?

1 次查看(过去 30 天)
Minh
Minh 2022-9-21
I need to calculate % by dozens of formulas x = (x% 100) / 10 but in MATLAB behind % is a comment?

采纳的回答

Image Analyst
Image Analyst 2022-9-21
Try this:
x = 23;
str = sprintf('%3.3d', x)
fprintf("hundreds :%s\n", str(1));
fprintf(" tens :%s\n", str(2));
fprintf(" units :%s\n", str(3));
x = 456
str = sprintf('%3.3d', x)
fprintf("hundreds :%s\n", str(1));
fprintf(" tens :%s\n", str(2));
fprintf(" units :%s\n", str(3));
  4 个评论
Minh
Minh 2022-9-22
i want to use formula to calculate but you helped me to do a simpler way that's what i asked for.!
Image Analyst
Image Analyst 2022-9-22
OK, then please Accept the best answer and "vote" for the other one.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by