Fastest Way of Opening and Reading .csv Files (Currently using xlsread)
조회 수: 148 (최근 30일)
I am currently trying to convert 100,000+ csv files (all the same size, with the same data structuring on the inside) to mat files, and I am running into the issue that it takes an extremely long time, and sometimes Excel stops responding. Are there any other functions that could cut down on the read time of these .csv files?
I read something about trying the COM server that runs Excel, but I am not sure how to implement it. Any thoughts?
추가 답변 (3개)
Jeremy Hughes 2017년 8월 23일
Since you have multiple files, you may want to consider using datastore. (Since R2014b)
In many cases, you can just use the following pattern to read a large collection of files,
ds = datastore('folder/containing/your/files')
t = read(ds)
% do stuff to t.
Hope this helps,
TastyPastry 2016년 5월 23일
There's a function csvread() which only works on numeric data.
The other way you can do it is to use textscan(). Both of those methods should be faster than xlsread() since xlsread() uses Excel, which is pretty slow.