Hello, in the demo code below you can find some comments and a procedure on how to get the indexes, extract the data and sum over the third dimension.
load("Matrix.mat")
% create the indexes
Jan_Idx = 1 : 12 : 20*12; % january
Mar_Idx = 3 : 12 : 20*12; % march
% create the indexes for january and march
Idx = sort( [Jan_Idx Mar_Idx] )
% extract these monts from the data
MyData = TDDb( :,:,Idx );
% now sum over the third dimension
MyData = sum( MyData, 3)