how to swap rows of a matrix using command linalg::swapRow(A, 1, 2)
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
studentambitious
el 3 de En. de 2017
Comentada: Rakib Seemanto
el 1 de Nov. de 2020
i need to swap two rows of a matrix.. how can i use the command linalg::swapRow(A, 1, 2)
0 comentarios
Respuesta aceptada
Walter Roberson
el 3 de En. de 2017
feval(symengine, 'linalg::swapRow', A, 1, 2)
The output of this will be a symbolic matrix. If your matrix is numeric, then you should double() the result of the feval() to get back to numeric.
However... unless you are poking into the MuPAD engine, you are better off writing a small function:
function A = swapRow(A, row1, row2)
A([row2, row1], :) = A([row1, row2], :);
0 comentarios
Más respuestas (1)
Neel Shah
el 1 de Nov. de 2019
i want to swap rows of 3*3 matrix
i.e. first row become last
second row become second last
4 comentarios
Ver también
Categorías
Más información sobre Matrix Operations and Transformations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!