Borrar filtros
Borrar filtros

convert a 1*16 matrix to a 2*8 matrix

7 visualizaciones (últimos 30 días)
Eranja Noopehewa
Eranja Noopehewa el 31 de Jul. de 2018
Editada: Fangjun Jiang el 31 de Jul. de 2018
I have a matrix of size 1*16 like [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] i want to convert it to a 2*8 matrix like [1 2 3 4 5 6 7 8;9 10 11 12 13 14 15 16] (i.e the first eight elements in the first row and the second eight elements in the second row)

Respuesta aceptada

Stephen23
Stephen23 el 31 de Jul. de 2018
>> V = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16];
>> reshape(V,[],2).'
ans =
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16

Más respuestas (1)

Fangjun Jiang
Fangjun Jiang el 31 de Jul. de 2018
Editada: Fangjun Jiang el 31 de Jul. de 2018
reshape()
transpose()

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by