How to remove scientific notation from an excel import?

22 views (last 30 days)
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 Comment
Stephen23
Stephen23 on 16 Aug 2023
Edited: Stephen23 on 16 Aug 2023
"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.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 16 Aug 2023
Edited: Cris LaPierre on 16 Aug 2023
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
A = 1.2346e+14
format long g
A
A =
123456789012345
  1 Comment
Walter Roberson
Walter Roberson on 16 Aug 2023
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.

Sign in to comment.

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!