Extract data from ASCII text file from specific lines and columns
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi Guys,
I have a compilation of reports in an ASCII file (see the file here: http://pastebin.com/wmmB92ZC ) I want to export them to MATLAB and I know the specific location of the data in column and line.
For example, the data for parameter N1 is located at line 37&38 at column 4. The next data for N1 comes after every 53 lines, which are 90&91, 143&,144 and so on.
I did try with text scan, but there is no option to specifically tell the exact location of the data in columns and lines.
Any help would be appreciated.
Thanks.
Regards, Wan
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 4월 18일
There is an undocumented textscan() option to specify column location. Unfortunately it only works with purely numeric data.
Anyhow, use the HeaderLines parameter to indicate how many lines to skip. Use a '%*s%*s%*s%d' format to skip the fist 3 columns and read the 4th as a number.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!