How to format scientific notation to have the same power?
조회 수: 28 (최근 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!