How to use "str2num" to read the first column of a comma separated data?

I have a data file that consists of 8768 lines. The first 9 lines are header lines that are not in my interest. the lines below the header lines are tabular data with commas separating the elements of each column. The first column is a 4-digit number that states the year (e.g 1997).
My question is: How can I get the years from each row? (which is the same as the first 4 digits or the row or the digits before the first comma) and the command shall contain "str2num" notation.

답변 (1개)

str2num isn't really intended for this purpose. Why not use textscan, dlmread, or similar?
doc textscan
doc dlmread

카테고리

도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

태그

질문:

2012년 4월 2일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by