Can not Read CSV file with readtable function

6 vues (au cours des 30 derniers jours)
Marzuki Marzuki
Marzuki Marzuki le 9 Mar 2021
Commenté : Walter Roberson le 27 Mai 2021
I have CSV file with several line of headers. I tried to read the data simply as:
data = readtable('D96035_2019010300.xls');
However, I got error.
Is there any option to read it?
Thank you for help.
  3 commentaires
Marzuki Marzuki
Marzuki Marzuki le 9 Mar 2021
Sorry walter, I receive the data from my friend and he said CSV, sorry the file is xls format
Cris LaPierre
Cris LaPierre le 9 Mar 2021
The file you have shared is not an xls file. It's a csv file that has had its extension changed to xls.

Connectez-vous pour commenter.

Réponse acceptée

Cris LaPierre
Cris LaPierre le 9 Mar 2021
The error I encountered is because the extendion of your csv file was changed xls. Change it back to csv, and readtable should work fine.
data = readtable('D96035_2019010300.csv')
data = 4794x41 table
ObsTime DCnt ST RE SondeN FCnt AGC rcvFREQ WM WD WS Height Xdistanc Ydistanc GF HDP PDP GeodetLat GeodetLon V Press0 Temp0 Humi0 FE FRT FTI FVH FVL FSP1 FSP2 FSP3 FSP4 N N1 N2 N3 N4 N5 N6 N7 N8 ________ ____ __ __ __________ ____ ___ _______ __ ______ ____ ______ ________ ________ __ ___ ___ _________ _________ _ ______ _____ _____ __ ______ ___ ______ ______ ____ ____ ______ ____ __ __ __ __ __ __ __ __ __ 06:29:57 0 7 0 7.0074e+06 3356 0 400.7 1 0 0 7 0 0 2 0.8 1.4 3.5956 98.862 0 1011.3 25 85.1 0 364.62 0 327.77 355.91 0 2.21 193.03 0 12 2 6 12 13 15 19 20 25 06:29:58 2 7 0 7.0074e+06 3358 0 400.7 1 0 0 7.1 2.7 -3 2 0.8 1.4 3.5956 98.862 0 1011.3 24.8 86 0 364.62 0 327.7 355.91 0 0 0 0 12 2 6 12 13 15 19 20 25 06:29:59 4 7 0 7.0074e+06 3360 0 400.7 1 0 0 7.1 2.7 -3 2 0.8 1.4 3.5956 98.862 0 1011.3 24.7 86.2 0 364.62 0 327.7 355.91 0 2.21 193.05 0 12 2 6 12 13 15 19 20 25 06:30:00 6 7 0 7.0074e+06 3362 0 400.7 1 0 0 7.3 2.7 -3 2 0.8 1.4 3.5956 98.862 0 1011.3 24.6 86.1 0 364.62 0 327.73 355.91 0 0 0 0 12 2 6 12 13 15 19 20 25 06:30:01 8 7 0 7.0074e+06 3364 0 400.7 1 0 0 7.4 2.7 -3 2 0.8 1.6 3.5956 98.862 0 1011.3 24.6 86 0 364.62 0 327.73 355.91 0 2.21 193.15 0 12 2 6 12 13 15 19 24 25 06:30:02 10 7 0 7.0074e+06 3366 0 400.7 1 0 0 7.5 2.7 -2.6 2 0.8 1.6 3.5956 98.862 0 1011.2 24.6 86 0 364.62 0 327.74 355.91 0 0 0 0 12 2 6 12 13 15 19 24 25 06:30:03 12 7 0 7.0074e+06 3368 0 400.7 1 0 0 7.7 2.7 -2.5 2 0.8 1.4 3.5956 98.862 0 1011.2 24.6 86 0 364.62 0 327.74 355.91 0 2.21 193.21 0 12 2 6 12 13 15 19 20 25 06:30:04 14 7 0 7.0074e+06 3370 0 400.7 1 0 0 7.9 2.7 -2.3 2 0.8 1.6 3.5956 98.862 0 1011.2 24.6 86 0 364.62 0 327.75 355.91 0 0 0 0 12 2 6 12 13 15 19 24 25 06:30:05 16 7 0 7.0074e+06 3372 0 400.7 1 295.2 0.07 9 2.7 -2.3 2 0.8 1.5 3.5956 98.862 0 1011.1 24.6 85.9 0 364.62 0 327.75 355.91 0 2.21 193.22 0 12 2 12 13 15 19 20 24 25 06:30:06 18 7 0 7.0074e+06 3374 0 400.7 1 260.73 0.36 11.2 2.7 -2.3 2 0.8 1.5 3.5956 98.862 0 1010.8 24.6 86 0 364.62 0 327.74 355.91 0 0 0 0 12 2 12 13 15 19 20 24 25 06:30:07 20 7 0 7.0074e+06 3376 0 400.7 1 241.3 0.68 14 2.7 -2.3 2 0.7 1.4 3.5956 98.862 0 1010.5 24.6 86.1 0 364.62 0 327.74 355.91 0 2.21 193.22 0 12 2 5 12 13 15 19 20 24 06:30:08 22 7 0 7.0074e+06 3378 0 400.7 1 251.05 0.97 17.3 2.7 -2.3 2 0.8 1.6 3.5956 98.862 0 1010.1 24.6 86.1 0 364.62 0 327.74 355.91 0 0 0 0 12 2 5 12 13 15 19 24 25 06:30:09 24 7 0 7.0074e+06 3380 0 400.7 1 267.31 1.13 20.8 2.7 -2.3 2 0.8 1.6 3.5956 98.862 0 1009.7 24.6 85.9 0 364.62 0 327.74 355.91 0 2.21 193.26 0 12 2 5 12 13 15 19 24 25 06:30:10 26 7 0 7.0074e+06 3382 0 400.7 1 266.07 1.46 24.4 2.7 -1.9 2 0.8 1.6 3.5956 98.862 0 1009.3 24.6 85.8 0 364.62 0 327.74 355.9 0 0 0 0 12 2 5 12 13 15 19 24 25 06:30:11 28 7 0 7.0074e+06 3384 0 400.7 1 254.38 1.56 28.2 4.2 -1.5 2 0.8 1.6 3.5956 98.862 0 1008.9 24.6 85.7 0 364.62 0 327.74 355.9 0 2.21 193.26 0 12 2 5 12 13 15 19 24 25 06:30:12 30 7 0 7.0074e+06 3386 0 400.7 1 249.98 1.68 32.2 4.2 -0.8 2 0.8 1.4 3.5956 98.862 0 1008.4 24.7 85.6 0 364.62 0 327.73 355.88 0 0 0 0 12 2 5 6 12 13 15 20 25
  11 commentaires
Marzuki Marzuki
Marzuki Marzuki le 27 Mai 2021
Sorry @Walter Roberson, after cheking my mathworks account, it seems my Matlab 2019b not 2020a. Does not it work for R2019 b version ?
Walter Roberson
Walter Roberson le 27 Mai 2021
filename = 'D96035_2016010100.CSV';
opt = detectImportOptions(filename, 'headerlines', 6);
data = readtable(filename, opt);

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Cell Arrays 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!

Translated by