How to use "str2num" to read the first column of a comma separated data?
5 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Matt Kindig
on 2 Apr 2012
str2num isn't really intended for this purpose. Why not use textscan, dlmread, or similar?
doc textscan
doc dlmread
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!