list = (0:10)
the element it is in-between is 3 and 4
What is the most efficient way of finding where 2.5 would lie in that list and which elements it would be in-between?
Is there a better way than doing a for loop?
for i = 1:length(list)
if number > list(length(list))
fprintf('it is greater than any the numbers')
if number == list(i)
fprintf('it is element %d',i)
if number < list(length(list))
if number > list(i)
if number < list(i+1)
fprintf('it is between element %d and %d ',i,i+1 )