Import data of flexible / variable size with textscan

I have a data file with the following format (schematic):
header text 1
header text 2
header text 3
x1 x2 x3 x4 x4 x6 ... xn
1.200e-4 2.800e+3 4.512e+2 ... 8.903e+3
.
.
.
2.210e-4 2.800e+3 4.533e+2 ... 8.997e+3
In the above, the data (matrix) has an unknown number of rows and columns. I use the following command:
A = textscan(filename,formatSpec,'HeaderLines',4,'Delimiter',' ');
How to describe formatSpec in this case?

1 Kommentar

Rik
Rik am 9 Feb. 2017
read the file once to find out n (e.g. by counting the spaces in the 4th line), and then use repmat('%e3 ',n,1)

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

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

Produkte

Gefragt:

am 19 Jun. 2013

Kommentiert:

Rik
am 9 Feb. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by