MATLAB Answers

Changes matrix size matlab

1 view (last 30 days)
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

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 19 Jul 2019
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 Comments

Ibnu Darajat
Ibnu Darajat on 19 Jul 2019
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 on 19 Jul 2019
I do not have the Communications Toolbox. I cannot run your code.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Products


Release

R2016a