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.

Antworten (1)

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

Kategorien

Mehr zu Large Files and Big Data finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

am 2 Apr. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by