how do I turn the columns and rows in a random matrix?

We have a 4x3 matrix =
[9 11 13;
10 12 14;
11 13 15;
12 14 16]
and we want to turn the columns and rows around so that it will result in
[16 14 12
15 13 11
14 12 10
13 11 9
Who knows how to do this?

 Respuesta aceptada

James Tursa
James Tursa el 22 de Mayo de 2017
Editada: James Tursa el 22 de Mayo de 2017
result = flipud(fliplr(your_matrix));
or
result = reshape(your_matrix(end:-1:1),size(your_matrix));
or
result = your_matrix; result(:) = result(end:-1:1);

Categorías

Más información sobre Mathematics and Optimization en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 22 de Mayo de 2017

Respondida:

el 23 de Mayo de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by