function [Qs] = moyenneQ (yearMin, yearMax)
Data = load('QsMC_Mars.mat');
QsMC = Data.QsMC;
nYear = yearMax - yearMin + 1;
Qs = zeros(nYear, size(QsMC, 2));
iStart = 1;
for i = 1:nYear
year = yearMin + i - 1;
nbrJour = 365 + leapyear(year);
iEnd = iStart + nbrJour - 1;
if iEnd >= size(QsMC, 1)
break
end
Qs(i, :) = sum(QsMC(iStart:iEnd,:));
iStart = iEnd+1;
end
end
Best Answer