How to convert an array of exponential numbers to am array of whole numbers?
8 次查看(过去 30 天)
显示 更早的评论
Is there a command that gives answer like 1.0e+03 is automatically multiplied to each number in an array?
r =
1.0e+03 *
0.7856 1.2797 1.5753 1.6840 1.6275 1.4350 1.1415 0.7847 0.4028 0.0314
0 个评论
采纳的回答
Scott MacKenzie
2021-8-10
编辑:Scott MacKenzie
2021-8-10
Your question has nothing to do with "converting" numbers. Your question pertains to how numeric values are presented on the display.
It is common to confuse how numeric values are stored with how they are presented. Just copy and paste the following sequence of commands in MATLAB's Command Window and examine the output. Of course, you should also have a look at the documentation for the format (link) command.
r = [0.12345, 6789.0];
format
r
format short
r
format shorte
r
format shortg
r
format long
r
format longe
r
format longg
r
Output:
r =
1.0e+03 *
0.0001 6.7890
r =
1.0e+03 *
0.0001 6.7890
r =
1.2345e-01 6.7890e+03
r =
0.12345 6789
r =
1.0e+03 *
0.000123450000000 6.789000000000000
r =
1.234500000000000e-01 6.789000000000000e+03
r =
0.12345 6789
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!