Changes matrix size matlab

1 次查看(过去 30 天)
i generate this binary (16x1) :
A = randi ([0 1], 16,1);
and the result is :
0
0
0
1
1
0
1
0
0
0
1
1
0
0
0
1
My question is, how to make the matrix A become 2x8 matrix? So, the result like :
0 0 0 1 1 0 1 0
0 0 1 1 0 0 0 1
Thanks before

采纳的回答

Star Strider
Star Strider 2019-7-19
Use the reshape function, specifically:
Out = reshape(A, [], 2)'
producing (for the vector you posted):
Out =
0 0 0 1 1 0 1 0
0 0 1 1 0 0 0 1
  2 个评论
Ibnu Darajat
Ibnu Darajat 2019-7-19
if I have code like this =
a = randi ([100 200], 4000,8);
b = de2bi(a);
c = b(:);
how to make the C matrix back into the B matrix?
Star Strider
Star Strider 2019-7-19
I do not have the Communications Toolbox. I cannot run your code.

请先登录,再进行评论。

更多回答(0 个)

类别

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

产品


版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by