I have arry let say
A = [2 3 4 5 6 7 8 9]
I want to get the midpoint
like B = [5]
how to do it?
Try using end to automatically get the index of the last record and use ceil to round half the length when the length is not equal
end
ceil
B=A(ceil(end/2))
The MATLAB median function will work. If you have an array with an odd number of elements, it pulls the midpoint. Otherwise, if you have an even number of points, it averages two points in the middle.