Reshape an array into another

10 visualizaciones (últimos 30 días)
Riccardo Rossi
Riccardo Rossi el 29 de En. de 2019
Respondida: KSSV el 29 de En. de 2019
Hi everybody, I have an array like this:
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
how can i permute the array in another like this?:
1 2 3 4
9 10 11 12
17 18 19 20
25 26 27 28
5 6 7 8
13 14 15 16
21 22 23 24
29 30 31 32
Thank you so much!

Respuesta aceptada

Omer Yasin Birey
Omer Yasin Birey el 29 de En. de 2019
Editada: Omer Yasin Birey el 29 de En. de 2019
a = [1 2 3 4 5 6 7 8;...
9 10 11 12 13 14 15 16;...
17 18 19 20 21 22 23 24;...
25 26 27 28 29 30 31 32];
a = [a(:,1:end/2);a(:,end/2+1:end)]

Más respuestas (1)

KSSV
KSSV el 29 de En. de 2019
A = [1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32];
C = [A(:,1:4) ; A(:,5:end)] ;

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by