필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Cumsum range and values

조회 수: 1 (최근 30일)
Amine Ben Ayara
Amine Ben Ayara 2015년 12월 15일
마감: James Tursa 2015년 12월 15일
I am trying to write a loop where each row of the output matrix represents a cumulative sum of the elements of the input matrix, meanwhile adding restrictions ( I only want to the cumulative sum to operate up to the matrix cell/ element that is not zero, or in other words I want to stop the cumsum operation right before the cell value of that particular row is equal to zero) Example: Input row vector A= [1 1 1 2 3 4 5 1 2 1 5 4 1 0 0 0 0 0 0 0 0 0]; so basically I want to get a new vector that operates the cumsum(A) up to the 13th element, which is equal to1) and the rest of the entries need to remain as zeros. can anyone point me in the right direction or maybe suggest a more efficient way of doing this because my actual matrix is (14680*101) dimension.

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by