how to convert decimal values into 8bit binary sequence

조회 수: 8 (최근 30일)
Chandrashekar D S
Chandrashekar D S 2021년 5월 15일
댓글: Chandrashekar D S 2021년 5월 15일
hello everyone,
I am trying to convert 14*3 matrix integer value to 8bit binary sequence in a same matrix dimension.
i am using dec2bin function to achieve that but the result is not the same i expected.
A=[8 7 1;
4 10 1;
9 7 1;
7 10 1;
9 6 1;
4 8 1;
10 10 1;
2 7 255;
8 3 255;
7 5 255;
4 4 255;
4 6 255;
1 3 255;
2 5 255];
b=dec2bin(A,8);
please help me with this.It will be really helpful.
Thanks in adavance.

채택된 답변

VBBV
VBBV 2021년 5월 15일
%if true
for i = 1:length(A);
iwant{:,i} = dec2bin(A(i,:));
end
This results in a 1x14 cell array converted to binary characters

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by