Numbers of an Excel sheet are wrongly displayed in matlab
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaire
Stephen23
le 13 Fév 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
Réponse acceptée
Sarah Gilmore
le 13 Fév 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
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!