MATLAB: Combining two vectors of different elements in an order

cell arrayvectors

I have two vectors >> n=[2 18 5 22 29]; >> m=[3 6 17 20 30]; I wanted a new vector mn, which contains both the elements of n and m vector in an order such as >> mn=[2 3 5 6 17 18 20 22 29 30]

Best Answer

mn = sort([n(:)',m(:)']);