How to convert an array of exponential numbers to am array of whole numbers?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Haya Ali
am 10 Aug. 2021
Bearbeitet: Scott MacKenzie
am 10 Aug. 2021
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 Kommentare
Akzeptierte Antwort
Scott MacKenzie
am 10 Aug. 2021
Bearbeitet: Scott MacKenzie
am 10 Aug. 2021
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!