Filter löschen
Filter löschen

Efficient way to read in large dataset

2 Ansichten (letzte 30 Tage)
Mads
Mads am 1 Nov. 2011
Hi all.
I am to read in a set of data to Matlab which has 6 columns and more than 2 million rows. I tried reading the data as a tab delimited .txt file with the dataset function as such:
pricedata = ...
dataset('File',file,'Delimiter','tab','ReadObsNames',true) ;
This has gone on for more than 3 hours. Can someone suggest a better way to do it?

Akzeptierte Antwort

Peter Perkins
Peter Perkins am 1 Nov. 2011
Mads, you will most likely find that this:
>> help dataset/dataset
dataset Create a dataset array.
[snip]
DS = dataset('File',FILENAME,'Format',FORMAT, ...) creates
a dataset array using the TEXTSCAN function to read column-
oriented data in a text file. Specifying a format can
improve speed significantly for large files.
will read the file much faster. In your case, FORMAT might be something like '%f%f%f%f%f%f' if all the columns are numeric. Hope it helps.

Weitere Antworten (0)

Kategorien

Mehr zu Large Files and Big Data 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