...
for I=724:747;
J=2:8;
k=1:length(aN_Tang);
l=1:length(rN_Tang);
if ((I<LongitudeA(k)<=I+1 & J<DepthsA(k)<=J+1) & ...
(I<LongitudeR(l)<=I+1 & J<DepthsR(l)<=J+1))
...
J, k, and l are invariant and so should be outside the loop...
J=2:8;
k=1:length(aN_Tang);
l=1:length(rN_Tang);
for I=724:747;
if ((I<LongitudeA(k)<=I+1 & J<DepthsA(k)<=J+1) & ...
(I<LongitudeR(l)<=I+1 & J<DepthsR(l)<=J+1))
...
Now I is a single value and while k is a vector of some unknown length but thus the returned subarray LongitudeA(k) is also of that length (presuming the size of the array is commensurate with that and the values are within the array bounds). But, you have a disparate size between a single value I and a vector LongitudeA(k) which causes a Matlab failure. Similar problems occur with the other arrays.
Not precisely sure what you're really after here so not positive the right coding solution...
Best Answer