필터 지우기
필터 지우기

How can I read data from certain range in txt file in matlab?

조회 수: 5 (최근 30일)
Hung Jr Chen
Hung Jr Chen 2016년 8월 18일
댓글: Hung Jr Chen 2016년 8월 18일
Hi,
I would like to read from line 85 to line 1108 in txt file in matlab.
I don't know how to do it.
The data from line 85 to line 1108 looks like this:
I have 1024 data.
Can please anybody help me?
Thanks,
Hung Jr

채택된 답변

Walter Roberson
Walter Roberson 2016년 8월 18일
Use textscan() with HeaderLines set to 84, a format of '%f%f%f', and specify a count of (1108-85+1)
  댓글 수: 3
Walter Roberson
Walter Roberson 2016년 8월 18일
fid = fopen('YourFile.txt', 'rt');
datacell = textscan(fid, '%f%f%f', (1108-85+1), 'HeaderLines', 84, 'CollectOutput', 1);
fclose(fid);
YourInput = datacell{1};
Hung Jr Chen
Hung Jr Chen 2016년 8월 18일
Hi Walter,
Thanks it really works ! :D
Thank you,
Hung Jr

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by