Hello Raphael,
I understand you are trying to find the maximums in “st_Q_exert” around known indices of maximums in “st_T_exert” with a window of length 288. It can be done as follows:
load("Q_excerpt.mat");
load("T_excerpt.mat");
TT = synchronize(st_T_exert,st_Q_exert,'union', 'linear');
dailyTemp= reshape(TT.Temp(1:end-1),288,[]);
[valT,indT]=max(dailyTemp);
for i=2:length(indT)
idxT_all(i)=indT(i)+288*(i-1);
end
max_q=[];
for i=1:length(idxT_all)
lower_limit=idxT_all(i)-143;
upper_limit=idxT_all(i)+144;
if lower_limit<1
lower_limit=1;
end
if upper_limit>size(st_Q_exert,1)
upper_limit=size(st_Q_exert,1);
end
max_q(i)=max(st_Q_exert{lower_limit:1:upper_limit,"Q"});
end
max_q