how to find non zero minimum
이전 댓글 표시
hi, i have a [8200,1] matrix with zero and positive values. i need to find non zero minimum. please guide me if you can
채택된 답변
추가 답변 (2개)
Zoltán Csáti
2014년 10월 4일
Lets suppose your matrix is called A. Then you first select those elements that are non-zero (i.e. positive) and after that use the min function:
min(A(A > 0))
Erick Medina
2017년 11월 28일
1 개 추천
Declare a temp_variable which is a copy of your target vector and delete all indexes equal to zero.
temp_vec = vec; temp_vec(temp_vec==0) = []; min(temp_vec)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!