How to format scientific notation to have the same power?
28 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alfredo Scigliani
le 7 Déc 2021
Commenté : Walter Roberson
le 7 Déc 2021
I know this might be dumb but it is messing me up so much. I have a table with data that is in scientific notation. I would like for all the numbers to be displayed to the same power of 10^-10. for example instead of 1.5e-9 , I would like it to be displayed as 15e-10.
MATLAB Script
----------------------------------------------------------------------------------------------------
clear; clc;
x=[702.8530e-012; 1.1511e-009; 1.0467e-009; 1.3369e-009; 723.8877e-012; 748.1630e-012; 1.0198e-009; 1.1897e-009]
number=[ 1; 2; 3; 4; 5; 6; 7; 8]
T=table(number,x)
------------------------------------------------------------------------------------------------------
I would like for all those e-9 to be e-10, does not matter if some numbers have more digits or significant figures than others, the only thing that I am looking for is that 10^-10 format.
if anyone can help, I appreciate it a lot!
0 commentaires
Réponse acceptée
Walter Roberson
le 7 Déc 2021
table() objects do not support that customization. You would need to switch the items to text
2 commentaires
Walter Roberson
le 7 Déc 2021
x=[702.8530e-012; 1.1511e-009; 1.0467e-009; 1.3369e-009; 723.8877e-012; 748.1630e-012; 1.0198e-009; 1.1897e-009]
number=[ 1; 2; 3; 4; 5; 6; 7; 8]
T=table(number,x)
T.x = compose("%8.4f", T.x/1e-10) + "E-10"
The "8" part of the %8.4f might need to be adjusted if you had values that were higher scale relative to 1e-10 . Also note that values smaller than 1e-16 will show up as 0
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!