Below are two examples of arrays (with a special ordering with odd numbers on one side, and even number on the other side) I have, with some given len:9  7  5  3  1  2  4  6  811  9  7  5  3  1  2  4  6  8  10For some value z, I want to find the column the value is in. MATLAB code I wrote:if z == 1   column = ceil(len/2);   elseif logical(mod(z,2))   column = ceil(len/2) - (z-1)/2;else   column = ceil(len/2) + z/2;endDoes this above locate the correct column?
Locate a number in an array with a special ordering
matlab