필터 지우기
필터 지우기

Reading some part of a file

조회 수: 1 (최근 30일)
Yongmin
Yongmin 2015년 5월 10일
댓글: Yongmin 2015년 5월 10일
Hello. I have a text file to read and I use the following commands to read the data.
fid = fopen('filename.dat','r');
formatspec = '%8c %6c %6c %d %64c %10c %d %d %s %s %s';
data = textscan(fid,formatspec,'Delimiter',',');
To save memory for the cell "data", I'd like to read only last 3 text strings. Would you please how to read a part of the file?
Many thanks for sharing your time.

채택된 답변

per isakson
per isakson 2015년 5월 10일
Replace
formatspec = '%8c %6c %6c %d %64c %10c %d %d %s %s %s';
by
formatspec = '%*8c %*6c %*6c %*d %*64c %*10c %*d %*d %s %s %s';
  댓글 수: 1
Yongmin
Yongmin 2015년 5월 10일
Hi per isakson, Thanks a lot for your kind and prompt answer. It really is what I wanted to do.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by