remove the header while reading from a text file

10 visualizaciones (últimos 30 días)
sb
sb el 19 de Jul. de 2016
Comentada: Star Strider el 19 de Jul. de 2016
Hi! I am trying to read a text file by the following command:
a= importdata('D:\Input\0518060.txt') ;
The input file (attached) has a header and followed by a matrix of 480x480 elements. How can I remove the header and use the matrix only for the further operation? Thanks in advance.

Respuesta aceptada

Star Strider
Star Strider el 19 de Jul. de 2016
Use textscan:
fidi = fopen('surjendu 0518060.txt','r');
Datac = textscan(fidi, repmat('%f', 1, 480), 'HeaderLines',1, 'CollectOutput',1);
Data = Datac{1};
The ‘Data’ variable is your (480x480) double array.
  2 comentarios
sb
sb el 19 de Jul. de 2016
It worked. Thanks a lot.
Star Strider
Star Strider el 19 de Jul. de 2016
My pleasure.
If my Answer solved your problem, please Accept it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by