How to convert an array of exponential numbers to am array of whole numbers?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Haya Ali
le 10 Août 2021
Modifié(e) : Scott MacKenzie
le 10 Août 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 commentaires
Réponse acceptée
Scott MacKenzie
le 10 Août 2021
Modifié(e) : Scott MacKenzie
le 10 Août 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!