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 comentario

Rik
Rik el 9 de Feb. de 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)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 19 de Jun. de 2013

Comentada:

Rik
el 9 de Feb. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by