swap the values in matrix
Mostrar comentarios más antiguos
Hello,
I have a matrix
[2 3 4 5 6 7]
a=2
b=3
i want to swap two values
ans is
[3 2 4 5 6 7]
1 comentario
Raihan Ahmed
el 22 de Ag. de 2015
Easy Method to do this is swapping Using index
b=[2:7]; b=b([2,1,3:end]);
this will give you the result :)
Respuesta aceptada
Más respuestas (1)
Neel Shah
el 1 de Nov. de 2019
0 votos
how to swap element in the 3*3 matrix
like a(2,1)=a(4,3)
a(4,3)=a(2,1)
Categorías
Más información sobre Matrix Indexing 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!