Filter löschen
Filter löschen

Numbers of an Excel sheet are wrongly displayed in matlab

3 Ansichten (letzte 30 Tage)
Nadja
Nadja am 13 Feb. 2023
Kommentiert: Stephen23 am 13 Feb. 2023
Hello,
I have an Excel Sheet with GDP data (in million). As I divided it, there are decimals. I already checked for accidently put on 1000 delimiters. But the sheet is formatted as my other sheets. And with them, matlab generates reasonable Output. If i look at the data on Matlab (Open the Excel in matlab and set the cursor on the scientific number), the right number is displayed. After matlab reads the data, the number is X times larger.
The relevant sheet is "GDP"
E.g. for Australia in 1993, the numeric matrix in matlab contains a value of 3.121381394041596e+05 (=312138139404159000000) instead of 312138,13940416.
Maybe i am too focused and do not see a "silly" mistake in the format but i tried so many things and it does not work.
I would really appreciate some help.
Thank you and kind regards
Nadja
  1 Kommentar
Stephen23
Stephen23 am 13 Feb. 2023
"the numeric matrix in matlab contains a value of 3.121381394041596e+05 (=312138139404159000000)"
It is unclear how you get that large integer.
format long G
3.121381394041596e+05
ans =
312138.13940416

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Sarah Gilmore
Sarah Gilmore am 13 Feb. 2023
Hi Nadja,
I believe the data is being imported correctly into MATLAB. 3.121381394041596e+05 is equal to 312138.13940416 - just written in scientific notation. To see this, you can change the display format of numbers to longG via the format command.
>> t = readtable("4_SWYZ_Market Capitalization 1993-2010.xlsx", "Sheet", "GDP");
>> format longG
>> t.x1993(1)
ans =
312138.13940416
I hope this helps.
Best,
Sarah

Weitere Antworten (0)

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by