Combining two vectors of different elements in an order

3 vues (au cours des 30 derniers jours)
Raghavendra Reddy P
Raghavendra Reddy P le 26 Mai 2015
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]

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 26 Mai 2015
mn = sort([n(:)',m(:)']);
  1 commentaire
Raghavendra Reddy P
Raghavendra Reddy P le 26 Mai 2015
Thank you sir... it works exactly the way i wanted :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by