Peter Lok
Peter Lok

Reputation: 1

Find the minimum value above a certain threshold

I am trying to find the min value for values equal to or above 3. this doesn't work

A = [21,1, 2, 3, 4, 5, 6, 7, -1, 8, 9, 10]; 
idx=find(3<A & A==min(A)); 
A(idx)

Upvotes: 0

Views: 643

Answers (1)

Matthias W.
Matthias W.

Reputation: 1077

You can use logical indexing in Matlab.

min( A( A >= 3 ) )

Upvotes: 4

Related Questions