What is the fastest way to load many large files and then reuse that data

70 次查看(过去 30 天)
I have upwards of 200 .csv files that are around 500 MB each. Each file contains a one line text header and 10 columns of numeric data with many, many rows. I only need to load columns 2-4 once from any one of the files as that information is identical in all files. From all of the files, I need columns 5-8 only. The files are all in one folder with a systematic naming convention if that helps at all. What is the fastest way to do this the first time? I've tried importdata, textscan, and readmatrix and have either not been able to do what I want above or have found it still too slow. Once it's loaded, I'll do some manipulation and save it as a .mat to work on later. Am I right that saving as .mat will produce the fastest load times in the future?
  3 个评论
Walter Roberson
Walter Roberson 2020-8-20
textscan() with %* formats to skip columns is probably about the fastest you are going to get.
Daniel
Daniel 2020-8-28
One whole file is 301,409,168 bytes once loaded. I had been loading all the data and plotting some things as a sort of quality check. I don't suppose I'd know how to just load it and save it to a .mat in a piecewise fashion, though that might suffice for what I want.

请先登录,再进行评论。

回答(1 个)

Jalaj Gambhir
Jalaj Gambhir 2020-8-24
Hi,
Have a look here. You can probably use textscan.

类别

Help CenterFile Exchange 中查找有关 Text Data Preparation 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by