Why does import data hang up on 70 Mb file?

I'm trying to import data files consisting of lots of numbers from a text file. The data are not in columns they are just space delimited values in a text file.
Using importdata works on files < 10Mb but more than that, MatLab hangs up on me. Is there a better way to import numbers from a large text file. I've looked at filescan, but i don't see the advantage.
any advice would be appreciated.

Antworten (1)

dpb
dpb am 4 Sep. 2014
Bearbeitet: dpb am 5 Sep. 2014

1 Stimme

Are the values consistently space-delimited, not fixed width fields I gather from the description? If there aren't missing values, then the simplest would be textread which is the "red-haired stepchild" but has the advantage of not requiring cell arrays when don't need 'em and also handles the filename directly w/o the need for fopen explicitly.
Just try
x=textread('yourfilename');
and see if that doesn't please...alternatively, also almost trivial is
x=dlmread('yourfilename');
where the delimiter is inferred from the file. This is good as it then treats multiple delim's as one whereas if specify 'delimiter',' ' the extras will be significant.
textscan can do the same but to get the shape correct you have to know the number of fields/row which the above do automagically.

Kategorien

Mehr zu Large Files and Big Data finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 4 Sep. 2014

Bearbeitet:

dpb
am 5 Sep. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by