skipping elements of a row vector
6 ビュー (過去 30 日間)
古いコメントを表示
hello,
i have a row vector of 200 elements and i want to sum the first 10 values, skip the next 10 , then add the third set of 10 and it goes on until i reach the element 200
any idea on how to do that?
0 件のコメント
回答 (1 件)
madhan ravi
2019 年 4 月 14 日
idx=reshape(1:200,10,[]); % a is your row vector
sum(a(idx(:,1:2:end)))
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!