Effacer les filtres
Effacer les filtres

Convert String to binary in each element

10 vues (au cours des 30 derniers jours)
zahrein yaacob
zahrein yaacob le 13 Juil 2019
Commenté : zahrein yaacob le 13 Juil 2019
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"

Réponse acceptée

KALYAN ACHARJYA
KALYAN ACHARJYA le 13 Juil 2019
Modifié(e) : KALYAN ACHARJYA le 13 Juil 2019
kol='1';
data1=str2double(kol);
data2=logical(data1)
Command Window:
>> whos data2
Name Size Bytes Class Attributes
data2 1x1 1 logical
  4 commentaires
Guillaume
Guillaume le 13 Juil 2019
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 le 13 Juil 2019
Thanks , it works.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by