Changes matrix size matlab
1 view (last 30 days)
Show older comments
Ibnu Darajat
on 19 Jul 2019
Commented: Star Strider
on 19 Jul 2019
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
Accepted Answer
Star Strider
on 19 Jul 2019
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
More Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!