Good morning, I have an the following matrix 6*3:
1 1 1
1 1 1
0 1 1
1 1 0
1 1 1
0 0 1
I want to keep the first zero of each colomne and to replace the values that follow it by zeros to get:
1 1 1
1 1 1
0 1 1
0 1 0
0 1 0
0 0 0
Thank you for help bests

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2015년 5월 5일

1 개 추천

A = [1 1 1
1 1 1
0 1 1
1 1 0
1 1 1
0 0 1];
cumprod(A)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

질문:

Dam
2015년 5월 5일

댓글:

Dam
2015년 5월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by