필터 지우기
필터 지우기

Can not Read CSV file with readtable function

조회 수: 23 (최근 30일)
Marzuki Marzuki
Marzuki Marzuki 2021년 3월 9일
댓글: Walter Roberson 2021년 5월 27일
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
Marzuki Marzuki
Marzuki Marzuki 2021년 3월 9일
Sorry walter, I receive the data from my friend and he said CSV, sorry the file is xls format
Cris LaPierre
Cris LaPierre 2021년 3월 9일
The file you have shared is not an xls file. It's a csv file that has had its extension changed to xls.

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 3월 9일
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
Marzuki Marzuki
Marzuki Marzuki 2021년 5월 27일
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 2021년 5월 27일
filename = 'D96035_2016010100.CSV';
opt = detectImportOptions(filename, 'headerlines', 6);
data = readtable(filename, opt);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by