I have "d879c14e5b1fa7a413aa46bbbc2b8710" this in char form and I want to convert this into string. As i want to split 2-2 character into binary so i want to split it into string.

2 件のコメント

Stephen23
Stephen23 2018 年 11 月 26 日
"As i want to split 2-2 character into binary "
What does this mean?
Nitish Kumar
Nitish Kumar 2018 年 11 月 26 日
From the given string d8 79 c1 like this i want to seperate and want to convert into binary of 8 bit

サインインしてコメントする。

 採用された回答

Stephen23
Stephen23 2018 年 11 月 26 日
編集済み: Stephen23 2018 年 11 月 26 日

0 投票

>> str = 'd879c14e5b1fa7a413aa46bbbc2b8710';
>> dec2bin(sscanf(str,'%2x'))
ans =
11011000
01111001
11000001
01001110
01011011
00011111
10100111
10100100
00010011
10101010
01000110
10111011
10111100
00101011
10000111
00010000

4 件のコメント

Nitish Kumar
Nitish Kumar 2018 年 11 月 26 日
Thank you so much for this help. I got it.
Nitish Kumar
Nitish Kumar 2018 年 11 月 26 日
If i want to store each 8 bit binary into an array and then convert into decimal number between 0-255, how can i do this?
Stephen23
Stephen23 2018 年 11 月 26 日
編集済み: Stephen23 2018 年 11 月 26 日
"If i want to store each 8 bit binary into an array..."
It is already in a character array.
"...and then convert into decimal number between 0-255, how can i do this?"
Either get rid of the dec2bin:
>> sscanf(str,'%2x')
ans =
216
121
193
78
91
31
167
164
19
170
70
187
188
43
135
16
Or use bin2dec on the character array.
Nitish Kumar
Nitish Kumar 2018 年 11 月 26 日
Got it. Thank you so much.

サインインしてコメントする。

その他の回答 (1 件)

Mohammed Alrajeb
Mohammed Alrajeb 2019 年 8 月 19 日

0 投票

hi every one.
my question is I have string of binary (00000100) 64 bits I want to take them over the number of each number is 8 bits and convert it to int8 amd use this number as input to my equation . how can i do that by function.
thanks

カテゴリ

ヘルプ センター および File ExchangeData Type Conversion についてさらに検索

質問済み:

2018 年 11 月 26 日

回答済み:

2019 年 8 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by