loop subsampling a timetable for each year for annual max values
显示 更早的评论
I have 9 different daily-interval timetable datasets, each spanning ~100 years of data. I need to extract the maximum annual 5-day sum of variable values for each year, in each dataset.
I've figured out how I can get the maximum 5-day sum across the entire 100 year dataset:
v = Timetable_1of9.Var1 ;
n = 5 ;
N = length(v) ;
sumn = zeros(1, N - n + 1); % Pre-allocation
for i = 1:N - n + 1
sumn(i) = sum(v(i:(i+n-1))) ;
end
[val,idx] = max(sumn)
but I'm not sure of the most efficient way to do this for each year and each dataset. (I also need those values put back into 9 new timetables with each annual maximum assigned to 1-1-YYYY, to match in with later analysis I will be doing).
If there a way I can set up a batch or a another for loop to run through each? even if it just does 1 dataset at a time, I can easily copy the code 8 more times and change the input file. Doesn't need to be pretty, just needs to work.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!