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!