How do I replace Matrix elements
조회 수: 32 (최근 30일)
이전 댓글 표시
Given a matrix A replace elements not equal 0 and not equal 1 by 5. Use disp() function to print out the resulting array.
So far I've got
A(A~=0) = 5;
disp(A);
but do not know how to make it 0 AND 1.
댓글 수: 2
KSSV
2020년 10월 27일
When you use ~=0 and replace those with 5, the elements whch have 1 also will be eplaced by 5 right?
채택된 답변
참고 항목
카테고리
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!