How to permute the rows and columns in a matrix ?
Mostrar comentarios más antiguos
for example: I have matrix A: A = [1 2 3 4;5 6 7 8;9 10 11 12;13 14 15 16] how to permute between column 1 and column 4 ? how to permute between row 1 and row 3 ? thanks
Respuesta aceptada
Más respuestas (2)
Daniel Morais
el 21 de Mzo. de 2017
1 voto
Utilize x = x( : , randperm(c)), onde x é a matriz e c o número de colunas de x. O mesmo vale para a permutação de linhas: x = x( randperm(l) , : ) onde l é o número de linhas.
Sean de Wolski
el 30 de Dic. de 2013
So
A([4,1],:) = A([1,4],:)
?
1 comentario
Nguyen Trong Nhan
el 30 de Dic. de 2013
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!