What I am trying to do is associate the y1 value with an SSP(:,2) value depending upon its relationship to SSP(:,1) 's depth.
y1i = 0:-1:-200 ; %a list of depths
SSP(:,1) = 0:-5:-200 ; %is a list of depths, referred to 'depths' below.
depths = SSP(:,1) ;
SSP(:,2) = linspace(1500,1480,41) ; %is a list of speeds, reffered to 'c' below.
c = SSP(:,2) ;
j = numel(depths) ;
k = numel(y1i) ;
for m = 1:k ;
for n = 1:(j-1) ;
y1i(m) <= depths(n) & y1i(m) > depths(n+1) ;
c1(m) = c(n) ;
I will be grateful for any advice that is given.