Borrar filtros
Borrar filtros

Numbers of an Excel sheet are wrongly displayed in matlab

3 visualizaciones (últimos 30 días)
Nadja
Nadja el 13 de Feb. de 2023
Comentada: Stephen23 el 13 de Feb. de 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 comentario
Stephen23
Stephen23 el 13 de Feb. de 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

Iniciar sesión para comentar.

Respuesta aceptada

Sarah Gilmore
Sarah Gilmore el 13 de Feb. de 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

Más respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by