binary matrix to decimal number
조회 수: 7 (최근 30일)
이전 댓글 표시
I have binary matrix the dimensions of matrix (1*8) like this
1 0 1 1 0 0 1 0
I want to put that matrix into another matrix the dimensions of new matrix is ( 1*1) like this
10110010
then I want to conver into decimel number like this
178
Can you help me to do this problem
댓글 수: 0
채택된 답변
추가 답변 (1개)
Simon Chan
2022년 1월 21일
Try this:
A = logical([1 0 1 1 0 0 1 0]);
B = bin2dec(num2str(A))
댓글 수: 1
yanqi liu
2022년 1월 21일
a = [1 0 1 1 0 0 1 0 ];
b = strrep(num2str(a), ' ', '')
c = bin2dec(b)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!