how to load a file with header

조회 수: 1 (최근 30일)
hyunmin
hyunmin 2013년 8월 6일
my file has one header
for example, my file name is gobang_no_aircon_20130729.dat
Matlab time = labVIEW(time)/(24*60*60)+datenum('1904-0101','yyyy-mm-dd');
3457900800.00000 0 0 0 27.8300000000000 0
3457900805.00000 0 0 0 27.8300000000000 0
3457900810.00000 0 0 0 27.8300000000000 0
...
I want to load this file but ,because of the header, I can't please tell me how to load this file

답변 (1개)

Walter Roberson
Walter Roberson 2013년 8월 6일
fid = fopen('gobang_no_aircon_20130729.dat', 'r');
datacell = textscan(fid, '%g%g%g%g%g%g', 'headerlines', 1, 'collect', 1);
fclose(fid);
data_array = datacell{1};
  댓글 수: 6
hyunmin
hyunmin 2013년 8월 6일
I already put collectOutput but it said "bad string"
Jan
Jan 2013년 8월 6일
@hyumin: If you read the documentation of textscan(), you will find all required information. It would not be efficient to ask Walter to re-tell, what you can read there.

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

카테고리

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