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?

 Respuesta aceptada

the cyclist
the cyclist el 12 de Mzo. de 2013

2 votos

word = 'TEST';
binary = dec2bin(word)';
binary(:)-'0'
Does this do what you want? (Notice I needed to take a transpose.)

1 comentario

I Made
I Made el 12 de Mzo. de 2013
Editada: I Made el 12 de Mzo. de 2013
Yeah right, thank you

Iniciar sesión para comentar.

Más respuestas (1)

Shashank Prasanna
Shashank Prasanna el 12 de Mzo. de 2013

0 votos

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

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 12 de Mzo. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by