Return first few values to zero in a row
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi I would like to change only the first few values in a row to zero?
For example I have matrix A=[1 2 4 5 6 7 8 9 0 2 3 4 5 6]
If I want to make the first column until ninth column to be zero, the the new matrix B will be: B=[0 0 0 0 0 0 0 0 0 2 3 4 5 6].
If I want to make the first column until fourth column to be zero, the the new matrix B will be: B=[0 0 0 0 6 7 8 9 0 2 3 4 5 6].
I was thinking something like: A(1,:)=zeros(1,4) but it won't change to zero.
Thank you!
댓글 수: 0
채택된 답변
추가 답변 (1개)
Image Analyst
2021년 12월 29일
@Hokkien you might want to review the short training to go over these basic indexing rules:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!