change dec2bin in matlab to get a logical vector -


i'm looking quick way variat of dec2bin in matlab such it'll return logical variable vector. example given number n=8 output [1,0,0,0]. how can that?

the simplest way explode binary representation returned dec2bin (which string!):

dec2bin(n) == '1' 

for n = 8 returns logical vector

1     0     0     0 

this work if n vector of numbers.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -