Hi all, I'm hoping for some help on this problem.
I have a matrix A 384×320. every point represents a depth. I also have a vector b 1×50, which is depths from 0-500.
I want to find the index of b, that corresponds to the nearest depth within matrix A.
For example: A[1,1] = 256 b [1:10:500]
So the corresponding nearest index on b that is closest to 256 of A, would be index 26 (or b 251).
I've tried a few loops, but nothing working…this is the closest I can come, but not correct.
for i=1:384 for j=1:320 x=nearest(b<=A(i,j)); end end
Thank you in advance for your time! Corinne
Best Answer