Limit of TEXTSCAN for reading the number of rows of an excel sheet in MATLAB?
6 次查看(过去 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?
0 个评论
回答(1 个)
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!