how to sum first 140 elements every time in an (1 * 21000) array

2 ビュー (過去 30 日間)
pavan kumar
pavan kumar 2019 年 11 月 19 日
コメント済み: pavan kumar 2019 年 11 月 19 日
a=rand(1,21000);
how to add (1 to 140,141 to 280, 281 to 420........elements up to 20861 to 21000. and totally i have 21000/140=150 i.e (1row * 150 columns)
and store it in same 'a'

採用された回答

David Hill
David Hill 2019 年 11 月 19 日
b=sum(reshape(a,[140,150]));

その他の回答 (1 件)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019 年 11 月 19 日
solution:
a=rand(1,21000);
b=sum(reshape(a,140,[]));

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by