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

조회 수: 2 (최근 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

채택된 답변

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개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by