MATLAB Answers

How to convert an array of exponential numbers to am array of whole numbers?

2 ビュー (過去 30 日間)
Haya Ali
Haya Ali 2021 年 8 月 10 日
編集済み: Scott MacKenzie 2021 年 8 月 10 日
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

採用された回答

Scott MacKenzie
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 件)

Community Treasure Hunt

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

Start Hunting!

Translated by