How can I read data from certain range in txt file in matlab?
조회 수: 5 (최근 30일)
이전 댓글 표시
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155828/image.png)
I have 1024 data.
Can please anybody help me?
Thanks,
Hung Jr
댓글 수: 0
채택된 답변
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
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};
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!