What the binary language which MATLAB deals with it to convert text to binary ?

2 ビュー (過去 30 日間)
Abduellah Elbakoush
Abduellah Elbakoush 2022 年 4 月 12 日
回答済み: DGM 2022 年 4 月 12 日
I have text and I want to convert the text to binary language
Example
The text is =(Hello world)
binary language=(00010010 10100110 00110110 00110110 11110110 00000100 11101010 11110110 01001110 00110110 00100110)

採用された回答

DGM
DGM 2022 年 4 月 12 日
Start with
textchar = 'Hello world';
textbin = dec2bin(double(textchar),8)
textbin = 11×8 char array
'01001000' '01100101' '01101100' '01101100' '01101111' '00100000' '01110111' '01101111' '01110010' '01101100' '01100100'
if you want that as a logical array, then
textlogical = textbin == '1'
textlogical = 11×8 logical array
0 1 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 1 0 0
if you want to change the endianness
textbin = fliplr(textbin)
textbin = 11×8 char array
'00010010' '10100110' '00110110' '00110110' '11110110' '00000100' '11101110' '11110110' '01001110' '00110110' '00100110'
and so on

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Data Preparation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by