Reading .dat file with multipe headers
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone,
I am trying to import some data into matlab and it has multipe headers throughout the data set. I would like to import the data and remove all the headers and just have the data. The data set looks like the following:
Header 1
stress strain
1 1
2 2
3 3
4 4
header 2
stress strain
1 1
2 2
3 3
4 4
This data set is small just for representation. My actual data set has 4 columns. I know how to imort the data if I manuall remove all the headers, but it's tedious as they are inserted after every so many rows. So I only want to return the data as follows
stress strain
1 1
2 2
3 3
4 4
1 1
2 2
3 3
4 4
댓글 수: 0
답변 (1개)
dpb
2013년 9월 10일
doc textscan
If it were me I'd not read the titles unless they're variable and unknown or if they are needed to be obtained from the file instead of being known then I'd only do that one time.
Use the 'headerlines' option and wrap textscan in a loop. There
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!