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);

 Respuesta aceptada

Torsten
Torsten el 8 de Feb. de 2016

0 votos

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

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Feb. de 2016

Respondida:

el 8 de Feb. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by