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