Is there any instruction can ignore the "0" value and find the minimum value of a matrix ?

조회 수: 2 (최근 30일)
Is there any instruction can ignore the "0" value and find the minimum value of a matrix ? I mean ,if i assume
A=[0 1 2 3]
How do i write the code to let the minimum value is 1 instead of 0

채택된 답변

KSSV
KSSV 2019년 4월 2일
편집: KSSV 2019년 4월 2일
A=[0 1 2 3]
[val,idx] = sort(A) ;
iwant = val(2)
A(A==0) = NaN
min(A)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Argument Definitions에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by