skipping elements of a row vector
조회 수: 10 (최근 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!