필터 지우기
필터 지우기

Changes matrix size matlab

조회 수: 1 (최근 30일)
Ibnu Darajat
Ibnu Darajat 2019년 7월 19일
댓글: Star Strider 2019년 7월 19일
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에서 Matrices and Arrays에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by