필터 지우기
필터 지우기

Limit of TEXTSCAN for reading the number of rows of an excel sheet in MATLAB?

조회 수: 4 (최근 30일)
yashvin
yashvin 2015년 7월 30일
댓글: yashvin 2015년 7월 30일
Hello, My code is
f2 = fopen('Airport Data.csv');
ff2=['%s','%*s','%*f','%*s','%*f','%f','%f'];
D1 = textscan(f2,ff2,'Delimiter',',','HeaderLines',1);
Airport_data=D1{1}
My Airport Data.csv contains about 20000 rows. MATLAB can only read up to 4835 rows. Any help of reading until the end of the file?

답변 (1개)

Walter Roberson
Walter Roberson 2015년 7월 30일
That code is not for reading an Excel sheet, it is for reading a text file with a comma delimiter.
textscan stops reading when the form stops matching. I suspect that you will find that the last entry of what was read will not have a valid value in D{2}(end) or D{3}(end)
Go into an editor or something similar and look at lines 4835 and 3486 and I think you will find that one of the two is not the format you expect.
  댓글 수: 3
Walter Roberson
Walter Roberson 2015년 7월 30일
The line that is causing the problem, what does it look like?
yashvin
yashvin 2015년 7월 30일
It contains a string separated by a comma. At many sections, i am having similarly
'BATON ROUGE METRO, RYAN FLD

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

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by