필터 지우기
필터 지우기

matrix multiplication issue.. i need the result to be in binary numbers

조회 수: 2 (최근 30일)
mary
mary 2013년 12월 2일
댓글: sixwwwwww 2013년 12월 2일
i have
m=rand(1,4)>0.5;
G=[1 1 1 1 1 0 0 0 1 0 0 0; 0 0 1 1 0 0 0 1 0 1 0 0; 1 1 1 0 1 0 0 1 0 0 1 0; 1 0 0 1 1 1 0 1 0 0 0 1];
when i multiply them c=m*G;
c will be a vector of integer no .. i want it to be a vector of zeros and ones how should i do that?

채택된 답변

sixwwwwww
sixwwwwww 2013년 12월 2일
Dear Mary, you can do it as follow:
m = rand(1,4) > 0.5;
G = [1 1 1 1 1 0 0 0 1 0 0 0; 0 0 1 1 0 0 0 1 0 1 0 0; 1 1 1 0 1 0 0 1 0 0 1 0; 1 0 0 1 1 1 0 1 0 0 0 1];
c = double(logical(m * G));
It is what you need?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Operations and Transformations에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by