Interesting problem. Here is one possible solution:
dates = {'01/01/1975'; '05/01/1975'; '25/01/1975'; '05/02/1975';...
'15/02/1975';'12/03/1975';'17/02/1978'};
data = [75;25;30;70;32;24;49];
time = datenum(dates,'dd/mm/yyyy'); % Convert strings to Matlab dates
[Y,M] = datevec(time); % Extract year and month vectors
mnthno = Y*12+M; % Unique value for every month
[C,ia] = unique(mnthno); % List of unique months
sums = zeros(size(C)); % Allocate space for the sums
for i = 1:length(C)
sums(i) = sum(data(mnthno==C(i))); % Sum data for each month
% Display results:
fprintf('Year: %4d, Month = %2d, sum = %6.2f \n',...
Y(ia(i)),M(ia(i)), sums(i));
end
You should type
doc datenum
doc datevec
doc unique
if you are not sure what the different functions do.