How to separate binary values ?

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일

2 개 추천

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일

0 개 추천

No direct way, but some jugglery:
A = (reshape(binary',1,7*4))-'0'

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

질문:

2013년 3월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by