selecting 2 bits from given input bit stream alternatively

조회 수: 1 (최근 30일)
Jetty Rakesh Aditya
Jetty Rakesh Aditya 2021년 8월 17일
답변: David Hill 2021년 8월 17일
say i have an array a= [1,0,0,1,1,0,0,1]
i want to make 2 arrays
b = [10,10]
c = [01,01]

채택된 답변

David Hill
David Hill 2021년 8월 17일
A=reshape(a,2,[])';
b=A(1:2:end,:);
c=A(2:2:end,:);%matrix form
%you could also convert to binary
A=sum(A.*[2 1],2);
b=dec2bin(A(1:2:end),2);
c=dec2bin(A(2:2:end),2);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by