adding vector entry after each element
1 回表示 (過去 30 日間)
古いコメントを表示
This is a very basic question but how would I add the elements of a vector like so...:
x = [1,2,3,4,5,6];
ans = 3 6 10 15 21
0 件のコメント
採用された回答
その他の回答 (1 件)
Sean de Wolski
2012 年 8 月 15 日
And just for fun:
filter(x(2:end),1,ones(1,numel(x)-1))+x(1)
参考
カテゴリ
Help Center および File Exchange で Data Preprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!