sum, vector elements, except i-th
조회 수: 11 (최근 30일)
이전 댓글 표시
hi,
how can I sum vector elements, say v = rand(1,30), except 12th one?
thanks,
댓글 수: 0
채택된 답변
Mona
2015년 7월 8일
You can always do the sum, then subtract that single element, 12th, from the sum.
v = rand(1,30);
sum_except12=sum(v)-v(12)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!