Threshold the matrix with vector
이전 댓글 표시
Let say I have a matrix M with m x n dimensions. I want to threshold each column by different threshold. let say N contains the threshold for each column, therefore the dimension of N is n x 1 or 1 x n.
how can I do this by single command.
채택된 답변
추가 답변 (1개)
Wayne King
2012년 10월 8일
편집: Wayne King
2012년 10월 8일
A = randn(5,3);
n = [0.5 0.8 0.2];
thresh = bsxfun(@gt,A,n);
B = A.*thresh;
B contains nonzero elements only where elements in A exceed the thresholds in the vector n.
댓글 수: 2
Aravin
2012년 10월 8일
Wayne King
2012년 10월 8일
thresh is the 0 1 matrix just as I describe above
카테고리
도움말 센터 및 File Exchange에서 Image Thresholding에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!