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

7 次查看(过去 30 天)
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)

采纳的回答

Stephen23
Stephen23 2018-7-31
>> 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

更多回答(1 个)

Fangjun Jiang
Fangjun Jiang 2018-7-31
编辑:Fangjun Jiang 2018-7-31
reshape()
transpose()

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by