Hello all,
I have a sorted list of values and would like to find the index of the first element greater than some cutoff size. For example
min_val = 0.3;
arr = [.4, .8, .23, .19, .37];
arr_sorted = sort(arr);
index = find_first(arr_sorted,min_val);
Is there a better way to do this than a for loop? "find" would pull out every value that meets this condition and that would waste effort. On the other hand, I could use a while loop, but I would like to avoid looping if better methods exist.
first_index = 1;
while(arr_sorted(first_index)<min_val)
first_index += 1;
endwhile