How to change non zero value into 0?
1 次查看(过去 30 天)
显示 更早的评论
I want to manipulate n*n matrix such the first 10 non-zeros value in every column of matrix and change them into zero.Matrix is in the form of binary[0,1].
1 个评论
madhan ravi
2019-8-21
It's similar as your previous question:
B = cumsum(A, 1);
out = A .* (B > m)
And change the answer in John D' Errico's answer part 'last' to 'first'.
回答(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!