How to remove scientific notation from an excel import?
조회 수: 22 (최근 30일)
이전 댓글 표시
Hi there. I'm trying to import an xlsx worksheet into matlab as a numeric matrix. In the workflow I have it stresses that scientifc notation might cause an output I don't want.
I've made sure it's turned off in excel and all my data are to 8 decimal places, but as soon as I open it to import into matlab, a bunch of data are now written in scientific notation e.g., many "e-04" data. Can someone please let me know how to fix this?
댓글 수: 1
Stephen23
2023년 8월 16일
편집: Stephen23
2023년 8월 16일
"I've made sure it's turned off in excel"
This does nothing. In Excel (just like in MATLAB) how a numeric value is displayed (i.e. its format) makes absolutely no difference to the value stored in memory or in the XLSX file. As long as numeric data is correctly stored as numeric, then MATLAB will have no problem importing it as numeric (perhaps your "workflow" is warning you to not store number data as text).
Do not confuse what data are stored in memory with how numeric data are displayed to the user.
"...a bunch of data are now written in scientific notation e.g., many "e-04" data"
Try changing the FORMAT. If that does not work please upload a sample data file by clicking the paperclip button.
답변 (1개)
Cris LaPierre
2023년 8월 16일
편집: Cris LaPierre
2023년 8월 16일
The scientific notation in MATLAB is how large numbers are presented on the screen to make them easier to read. That does not modify the actual value. The same thing actually happens in Excel, as it applies formatting to how numbers are displayed.
A = 123456789012345
format long g
A
댓글 수: 1
Walter Roberson
2023년 8월 16일
For general numeric format,
- .xls files store the data in IEEE 754 binary double precision floating point.
- .xlsx files generally store the data with 17 significant digits. Scientific notation is used for exponents for items with absolute value less than (but excluding) 10^-4, and for 10^17 and larger, with 10^-4 to just under 10^17 not using scientific notation. Whatever notation is used internally in the xlsx file, the value is converted to IEEE 754 binary double precision floating point when the xlsx file is read in.
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!