edit large CSV file before reading it to a table

3 Ansichten (letzte 30 Tage)
sani
sani am 6 Mai 2021
Kommentiert: sani am 6 Mai 2021
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 Kommentare
Stephen23
Stephen23 am 6 Mai 2021
Bearbeitet: Stephen23 am 6 Mai 2021
How do you expect to get "...2 columns from this data..." from a "...CSV file that contains one column with data..." ?
sani
sani am 6 Mai 2021
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Mai 2021
Use 'delimiter', ';', and 'SelectedVariableNames' with a vector that is the two column numbers.
  1 Kommentar
sani
sani am 6 Mai 2021
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT Files finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by