In this particular case, the cell array use is not absolutely necessary. Try
K = logical(diff([x(1)+abs(x(1))*2e-7; x; x(end)-abs(x(end))*2e-7])<=0);
L = K(2:end) & [K(2); K(2:end-1)~=K(3:end)];
A cell array can often be replaced with a matrix when all cells of the cell array are of the same type. In this particular case, the cell array has only a single element, and therefore all elements are of the same type.