Divide by every N rows

2 ビュー (過去 30 日間)
david crowley
david crowley 2021 年 8 月 8 日
回答済み: KSSV 2021 年 8 月 8 日
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;

採用された回答

KSSV
KSSV 2021 年 8 月 8 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by