Convert string to a row matrix
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
hay i want to convert a string into a row matrix
wat i have: '01011100100000100001010110010111'
wat i need: [0 1 0 1 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 1 0 1 1 0 0 1 0 1 1 1]
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (2)
Azzi Abdelmalek
am 16 Jul. 2012
a= '01011100100000100001010110010111'
b=~isspace(regexprep(a, '0',' '))
2 Kommentare
Azzi Abdelmalek
am 17 Jul. 2012
Bearbeitet: Azzi Abdelmalek
am 17 Jul. 2012
my aswers is only valid for binary. i know it does'nt work for other numbers
khaled DAWOUD
am 17 Jul. 2012
Bearbeitet: khaled DAWOUD
am 17 Jul. 2012
a= '01011100100000100001010110010111'
% b is the matrix for the a.
for k=1:1:size(a,2)
b(k)=str2num(a(k));
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!