How to read a large CSV in chunks;

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 comentario

Jan
Jan el 23 de Ag. de 2018
Editada: Jan el 23 de Ag. de 2018
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.

Iniciar sesión para comentar.

Respuestas (1)

Rishi Binda
Rishi Binda el 28 de Ag. de 2018

0 votos

If you want to read specific range of the generated csv file you can use one of the following :
  • csvread
  • dlmread
  • xlsread

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Productos

Versión

R2017b

Preguntada:

el 23 de Ag. de 2018

Respondida:

el 28 de Ag. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by