MATLAB: Vectorization

vectorization

Dear Community,
Let say I have Matrix M. In Matrix M, each Column is feature of Image. Now what I want to get a binary matrix B by following way.
for given image feature i:
B(1,i) = M(1,i) >= M(2,i);
its mean for each image feature, each cell is compared to its next cell. I want to do it without loops for speed.

Best Answer

diff(M) <= 0