MATLAB: How to merge two matrix to one matrix

coordinatesmatrixmergesingle

I have x and y coordinates I need to merge them into one matrix having the size: Mx2
x=[50.2124 50.2133 50.2134 50.2134 50.2137];
y=[26.385 26.386 26.387 26.388 26.3859];
I need element 1 from x with element 1 with y and so on … how can I do this?

Best Answer

m = [x(:),y(:)]
e.g.:
>> x = [50.2124,50.2133,50.2134,50.2134,50.2137];
>> y = [26.385, 26.386, 26.387, 26.388, 26.3859];
>> m = [x(:),y(:)]
m =
50.212 26.385
50.213 26.386
50.213 26.387
50.213 26.388
50.214 26.386