MATLAB: Isolate Digits in a number

digit isolation

Take c input as
c= 0010100101100
Note: Please don't take c as char
isolate each digit into index of "nary"
i.e.,
>> naray =
0 0 1 0 1 0 0 1 0 1 1 0 0
i.e.,
nary(1)=0
nary(2)=0
nary(3)=1
nary(4)=0
nary(5)=1
nary(6)=0
nary(7)=0
nary(8)=1
nary(9)=0
nary(10)=1
nary(11)=1
nary(12)=0
nary(13)=0

Best Answer

If c is not a char, then what is it? How could you even enter c in MATLAB if it is not a char? You will lose the leading zeros if c is not a char.
>> c = 0010100101100
c =
10100101100
Related Question