findnext - Finding neighbours ...
The vector v2 contains numbers and the vector v1 is scanned for the next smallest and the next larger value. These both values are written to the matrix BOUNDS (2 columns). The 1st column contains the next smallest, the 2nd column the next larger values.
If there is no next smallest value, the the lower boundary is the minimal value of v1. Also if there is no next larger value, then the maximum of v1 is used as result.
v1=rand(1,10); v2=rand(1,5); v2=gsort(v2); v2=v2($:-1:1); bds=findnext(v1,v2); disp(v2); disp(bds);
findgrup ,