Left-hand side indexing issue
Afficher commentaires plus anciens
Dear all,
I have a matrix A:
A = [1,2,3,4,5,6,7,8; 1,2,3,4,5,6,7,8];
I would like to change the order of matrix columns. If I try for example:
B(:,[4 3 2 1 8 7 6 5]) = A
I get:
B =
4 3 2 1 8 7 6 5
4 3 2 1 8 7 6 5
which is correct.
Now I try:
B(:,[3 8 2 1 6 7 5 4])=A
and I get this weird result:
B =
4 3 1 8 7 5 6 2
4 3 1 8 7 5 6 2
Would you have an explanation? Thank you very much!
Tobard
Réponse acceptée
Plus de réponses (2)
Tobard
le 28 Nov 2011
Andrei Bobrov
le 28 Nov 2011
here all right
You want is it:
B = A(:,[3 8 2 1 6 7 5 4])
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!