edit large CSV file before reading it to a table

4 次查看(过去 30 天)
hi,
I have a very large (16Gb) CSV file that contains one column with data separated by semicolumn.
I only need 2 columns from this data, but I cannot read it first since the memory is running out (I have 16Gb ram).
Is it possible to somehow separate the semicolumn to a column and read only the data I need (which is 2/6 columns)?
  2 个评论
Stephen23
Stephen23 2021-5-6
编辑:Stephen23 2021-5-6
How do you expect to get "...2 columns from this data..." from a "...CSV file that contains one column with data..." ?
sani
sani 2021-5-6
It contain one column but the data is saperated in ';'.
basicly I needed to saperate it first and than to read only whats relevant for me.
see wallter solution, it was actually really halpful.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2021-5-6
Use 'delimiter', ';', and 'SelectedVariableNames' with a vector that is the two column numbers.
  1 个评论
sani
sani 2021-5-6
thank you very much walter!
for some reason not only that it maneged to read the data, it also write it really fast in readtable() function. much faster than other smaller files I'm reading.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by