How change two columns with 5 rows to a single row?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bajdar Nouredine
le 26 Juil 2024
Modifié(e) : David Goodmanson
le 26 Juil 2024
x= [2 4 6 8 10 ];
y= [20 40 60 80 100];
% I want to reprsent them in a single row like that z= 2 20 4 40 . . .
0 commentaires
Réponse acceptée
David Goodmanson
le 26 Juil 2024
Modifié(e) : David Goodmanson
le 26 Juil 2024
Hi Bajdar,
xy = [x; y];
z = xy(:)'
i.e. concatenate x and y vertically, read that matrix out columnwise, then take the transpose. If x or y could be complex, then
z = xy(:).'
(transpose, not complex conjugate transpose) is necessary.
0 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!