Substitute matrix values without mchange
조회 수: 1 (최근 30일)
이전 댓글 표시
I am using some code to substitute values without the symbolic toolbox. The code follows.
- 1: B=A(A>2)
- 2: T=zeros(size(A)
- 3: mask=A>2
- 4: T(mask)=A(mask)
A represents an absolute value matrix. The lines of code remove any value less than 2. We want to modify code so that it instead removes anything greater than 2 AND anything less than -2.
댓글 수: 0
채택된 답변
Guillaume
2014년 12월 9일
Not sure what this has got to do with the symbolic toolbox. It's basic matlab.
Anything greater than 2 and anything less than 2 is anything not equal to 2, so:
T = A;
T(T~= 2) = 0;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!