How to read a large CSV in chunks;

3 次查看(过去 30 天)
ariane
ariane 2018-8-23
I have the following code which filters a very large CSV.
opts = detectImportOptions('Z_EnergySequence.dat');
data = readtable('Z_EnergySequence.dat',opts);
tol = 1e-6;
filter = 4.125;
filterreddata = data(abs(data.X - filter) < tol, :);
filteredions = data(ismember(data.IonN, filterreddata.IonN),:);
filteredions(1:2:end,:)= [];
writetable(filteredions, 'Published/Z_EnergySequence1.csv');
I think I may be getting errors in the data processing. Is there a way in which I can read the whole CSV in chunks and output to the same file?
  1 个评论
Jan
Jan 2018-8-23
编辑:Jan 2018-8-23
I think I may be getting errors in the data processing
This seems to be a pure speculation. Do not try to fix not existing problems.

请先登录,再进行评论。

回答(1 个)

Rishi Binda
Rishi Binda 2018-8-28
If you want to read specific range of the generated csv file you can use one of the following :
  • csvread
  • dlmread
  • xlsread

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by