필터 지우기
필터 지우기

Read text file

조회 수: 3 (최근 30일)
Charles
Charles 2011년 12월 7일
Hi,
I have a text file which contains the following data format
3
abc (1:200, 200: 400)
bcd (1:300, 200: 300)
cde (1:100, 200: 500)
The first line tells me the number of lines to read in. How do I read in the values of the 2: 4th lines? I am using textread but it only returns the value of the first line.
Thanks. Charles

채택된 답변

the cyclist
the cyclist 2011년 12월 7일
There are at least a couple ways you can try. One is to use the textscan() command.
I also like the readtext() command from the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/10946 for this sort of thing.
  댓글 수: 1
Charles
Charles 2011년 12월 7일
textscan is exactly what I needed. Thanks.

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

추가 답변 (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