for loop with calculations across rows
古いコメントを表示
Hi there,
I have used MATLAB for less than a year and I now think I need to get the FOR loop (no previous experience).
a = [1 2 3 4 5 6; 1.05 1.08 0.98 1.0 1.01 0.93]'
a =
1.0000 1.0500
2.0000 1.0800
3.0000 0.9800
4.0000 1.0000
5.0000 1.0100
6.0000 0.9300
Need a FOR loop in MATLAB to calculate the EOD vector below

Calculation in Excel
C2 is A1*B1
C3 is C2*B3 + A2*B3
Etc.
I intend to use this on tables with more than 100,000 lines, but will implement on subgroups (assumption is to use splitapply). I think it could be sensible to consider preallocate to a vector with zeros, great if the solution can include preallocation and if you have considerations on how the FOR loop can be integrated into splitapply.
Thank you for your help, kind regards,
William
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!