How to remove scientific notation from an excel import?

22 Ansichten (letzte 30 Tage)
Julian
Julian am 16 Aug. 2023
Kommentiert: Walter Roberson am 16 Aug. 2023
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 Kommentar
Stephen23
Stephen23 am 16 Aug. 2023
Bearbeitet: Stephen23 am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Cris LaPierre
Cris LaPierre am 16 Aug. 2023
Bearbeitet: Cris LaPierre am 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 Kommentar
Walter Roberson
Walter Roberson am 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by