Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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

Réponse acceptée

KSSV
KSSV le 2 Avr 2019
Modifié(e) : KSSV le 2 Avr 2019
A=[0 1 2 3]
[val,idx] = sort(A) ;
iwant = val(2)
A(A==0) = NaN
min(A)

Plus de réponses (0)

Catégories

En savoir plus sur Argument Definitions dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by