Hello, I wouldlike to create a vectorwith the number of repititions of a number for example, I have this data:
clear allclcdata = [ 1 2004 3 5; 2 2004 7 2; 1 2005 9 4; 2 2005 6 5; 3 2005 3 7; 4 2005 8 2] % Where data(:,1) is id and data(:,2) is year.
I would like to create a code that counts the numbers of id per year in a vector, just like this:
result = [2 2 4 4 4 4]';
thank you very much in advance.
Best Answer