필터 지우기
필터 지우기

Read specific parts of a column?

조회 수: 1 (최근 30일)
ayat
ayat 2016년 11월 1일
댓글: Walter Roberson 2016년 11월 1일
I have used a script I found to change "," to "dot" and have my text file ready as two columns, a sample if attached. Now I want to read the file but it gives an errors since the first row is not numbers:
*Error using load Unknown text on line number 1 of ASCII file 2.txt "time/s".*
I want to load the file and read the numbers in each column. How do I go around doing this without having to manually delete the first row in the text file?

채택된 답변

Walter Roberson
Walter Roberson 2016년 11월 1일
If you have R2013b or later, you can use readtable(), which will know how to handle the header.
If you are using some version around R2015a or later, then you can use dlmread() with row specification.
You can use textscan() with HeaderLines, 1
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 11월 1일
All of the methods I suggested would have already removed the header.
If for some reason you need to skip the first numeric row as well, then
time_per_s = data(2:end, 1);

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

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