Convert String to binary in each element

Hi , i want to convert the string here in binary format so that i can manipulate the element of bits. I want to convert into binary for each element.
Here what i have:
kol =
10×1 string array
"1"
"0"
"1"
"1"
"1"
"1"
"0"
"1"
"1"
"1"

 Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 13 de Jul. de 2019
Editada: KALYAN ACHARJYA el 13 de Jul. de 2019
kol='1';
data1=str2double(kol);
data2=logical(data1)
Command Window:
>> whos data2
Name Size Bytes Class Attributes
data2 1x1 1 logical

4 comentarios

madhan ravi
madhan ravi el 13 de Jul. de 2019
str2num() is not recommended use str2double() instead
KALYAN ACHARJYA
KALYAN ACHARJYA el 13 de Jul. de 2019
Incorporated, Thank you @madhan ravi
Well, actually, since the input is a string array, just double will do it:
>> kol = ["0", "1", "1", "1", "1", "0", "1", "1", "1"];
>> double(kol)
ans =
0 1 1 1 1 0 1 1 1
zahrein yaacob
zahrein yaacob el 13 de Jul. de 2019
Thanks , it works.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Productos

Versión

R2018a

Etiquetas

Preguntada:

el 13 de Jul. de 2019

Comentada:

el 13 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by