Effacer les filtres
Effacer les filtres

Divide by every N rows

3 vues (au cours des 30 derniers jours)
david crowley
david crowley le 8 Août 2021
Réponse apportée : KSSV le 8 Août 2021
I am trying to perform the following calculation, but every 52 rows the denominator needs to change from (1,1) to (52,1) then (104,1) etc.
Can someone please assist?
rAPf(i,:) = ((tickPf(i,1) / tickPf(1,1))-1)*100;

Réponse acceptée

KSSV
KSSV le 8 Août 2021
t = 1 ;
for i = 1:n % n should be your last index
if mod(i,52) == 0
t = i ;
end
rAPf(i,:) = ((tickPf(i,1) / tickPf(t,1))-1)*100;
end

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by