remove the header while reading from a text file

조회 수: 9 (최근 30일)
sb
sb 2016년 7월 19일
댓글: Star Strider 2016년 7월 19일
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.

채택된 답변

Star Strider
Star Strider 2016년 7월 19일
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
sb
sb 2016년 7월 19일
It worked. Thanks a lot.
Star Strider
Star Strider 2016년 7월 19일
My pleasure.
If my Answer solved your problem, please Accept it.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by