rowfun (or other function?) to access multiple rows in a table (as in current + previous 5 rows)

3 ビュー (過去 30 日間)
Andy
Andy 2020 年 11 月 14 日
コメント済み: Peter Perkins 2020 年 11 月 19 日
Following the excel typical example, where a new column can be a formula accessing current row + values in row(s) above / below - based on a row-delta (that specifies how many rows above/below to access), what is the best way to accomplish this in Matlab?
looking at towfun grouping function - the grouping should be dynamic, as in: for Row N, the row function / formula should only access the previous 5 lines ... type of thing - not sure how could this be achievable through the rowfun
thanks
  1 件のコメント
Peter Perkins
Peter Perkins 2020 年 11 月 19 日
Rowfun doesn't work like that. It will do calculations on groups of rows, but not overlapping groups.
I'm guessing you can do what you want as something like t.NewVar = movsum(t.OldVar,...).

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by