Sum up row values
Mostra commenti meno recenti
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);
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!