MATLAB: Read a data set and bin it to different groups.

stringread

2004017 2004018 2004018 2006019 2004019 2004017 2004018 2004018 2005019 2004019 2004017 2004018 2004018 2008019 2004019
The first four numbers of each data give the year. I want to bin the data according to their years. How should I do that? if the year is 2004 assign it to an array T1. if the year is 2005 assign it to an array T2. So on.

Best Answer

A = [ List of numbers ];
x = floor(A/1000);
T1 = A( x == 2004 );
T2 = ...
...