How to format scientific notation to have the same power?
23 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2021-12-7
table() objects do not support that customization. You would need to switch the items to text
2 个评论
Walter Roberson
2021-12-7
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!