Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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

Akzeptierte Antwort

KSSV
KSSV am 2 Apr. 2019
Bearbeitet: KSSV am 2 Apr. 2019
A=[0 1 2 3]
[val,idx] = sort(A) ;
iwant = val(2)
A(A==0) = NaN
min(A)

Weitere Antworten (0)

Kategorien

Mehr zu Argument Definitions finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by