Classify data (cell array) based on years in MATLAB
- by user2991243
Suppose that we have this cell array of data :
a={43 432 2006;
254 12 2008;
65 35 2000;
64 34 2000;
23 23 2006;
64 2 2010;
32 5 2006;
22 2 2010}
Last column of this cell array is years. I want classify data(rows) based on years like this :
a_2006 = {43 432 2006;
32 5 2006;
32 5 2006}
a_2008 = {254 12 2008};
a_2000 = {65 35 2000;
64 34 2000}
a_2010 = {64 2 2010;
22 2 2010}
I have different years in column three in every cell array (this cell array is a sample) so I want an automatic method to determine the years and classify them to a_yearA , a_yearB etc. or other naming that I can distinguish years and call data years easily.
How can I do this?
Thanks.da