Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MATLAB - how do I find the first index where value is greater than threshold [duplicate]

Tags:

Possible Duplicate:
Given a vector a=[1,2, 3.2, 4, 5] and an element x=3 In vector a, how to find the exact entry which is bigger than x?

Let's say a[] is a sorted vector. How do I find the first(smallest) index ix such that a(ix) > threshold?

like image 344
Trup Avatar asked Aug 12 '11 14:08

Trup


People also ask

How do you find the index of the largest element in a matrix in MATLAB?

You can use max() to get the max value. The max function can also return the index of the maximum value in the vector. To get this, assign the result of the call to max to a two element vector instead of just a single variable. Here, 7 is the largest number at the 4th position(index).

What number does an array's index start with in MATLAB?

In MATLAB, indexes start at 1. Arrays can be sliced by using another array as an index.

How do you find the index of data in MATLAB?

In MATLAB the array indexing starts from 1. To find the index of the element in the array, you can use the find() function. Using the find() function you can find the indices and the element from the array. The find() function returns a vector containing the data.

How do you do greater than in MATLAB?

Description. A >= B creates the condition greater than or equal. ge( A , B ) is equivalent to A >= B .


1 Answers

ix = find(a>threshold,1); 

Pretty sure this will work

like image 106
Phonon Avatar answered Oct 22 '22 20:10

Phonon