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!