How to separate binary values ?

5 ビュー (過去 30 日間)
I Made
I Made 2013 年 3 月 12 日
I try to convert String to Binary , and after that i want to get
A [0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0];
word = 'TEST';
binary = dec2bin(word);
And we got 01010100 01000101 01010011 01010100, how i can separate all the binary value into 1 by 1 , it's only consist 0 and 1?

採用された回答

the cyclist
the cyclist 2013 年 3 月 12 日
word = 'TEST';
binary = dec2bin(word)';
binary(:)-'0'
Does this do what you want? (Notice I needed to take a transpose.)
  1 件のコメント
I Made
I Made 2013 年 3 月 12 日
編集済み: I Made 2013 年 3 月 12 日
Yeah right, thank you

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

その他の回答 (1 件)

Shashank Prasanna
Shashank Prasanna 2013 年 3 月 12 日
No direct way, but some jugglery:
A = (reshape(binary',1,7*4))-'0'

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by