How to get [1 0 1 0] from '1010'
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Durga Lal Shrestha
am 29 Sep. 2014
Kommentiert: Durga Lal Shrestha
am 30 Sep. 2014
Is there any built-in function or easiest way to get [1 0 1 0] from '1010' (character array)?
I have used for loop, but is there any other way to get the results?
str = '1010';
vec = zeros(length(str),1);
for i=1:length(str)
vec(i) = str2double(str(i));
end
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays 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!