# converting a binary string into double using commas for separation

9 visualizzazioni (ultimi 30 giorni)
Maria Imdad il 9 Set 2021
Commentato: Maria Imdad il 9 Set 2021
Hi Everyone,
I have one excel file, which has binary data and when i extract this data in matlab i get this as string i.e.
k='00101101011010101101101111101110111100000001010000110010011000101111000101001010';
now i want to convert it into
k=[0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0];
So that the values remain the same but i can convert it into a double like i mentioned above. Your help will be highly appretiated
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Dave B il 9 Set 2021
k='00101101011010101101101111101110111100000001010000110010011000101111000101001010'
k = '00101101011010101101101111101110111100000001010000110010011000101111000101001010'
str2double(num2cell(k))
ans = 1×80
0 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 1
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Maria Imdad il 9 Set 2021
it worked for me
Thank you

Accedi per commentare.

### Categorie

Scopri di più su MATLAB in Help Center e File Exchange

R2019a

### Community Treasure Hunt

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

Start Hunting!

Translated by