I have this program for finding the max precipitation for a 5 minute intervall. I was wondering if someone could help me find an alternative for the line
p_ny = p(row)+p(row-1)+p(row-2)+p(row-3)+p(row-4);
So when I want to find the maximum precipitation for longer time intervals i don't have to type in
p_ny = p(row) +.....+p(row-59);
for one hour...
Here is my full code:
clear all
data = load('samletmin');
ar = data(:,1);
mnd = data(:,2);
dag = data(:,3);
time = data(:,4);
min = data(:,5);
p = data(:,6);
[nrow,ncol] = size(data);
ny_p = [];
for row = 5:nrow
---> p_ny = p(row)+p(row-1)+p(row-2)+p(row-3)+p(row-4); <---
ny_p(end+1) = p_ny;
end
ny_p = ny_p';
[X,Y] = max(ny_p);

 채택된 답변

Torsten
Torsten 2016년 2월 8일

0 개 추천

p_ny = sum(p(row-4:row));
Best wishes
Torsten.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2016년 2월 8일

답변:

2016년 2월 8일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by