Integer array to binary array

前端 未结 3 2076
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 09:45

I have an integer array:

a=[3,4,5,6,7];

I want to convert it to a binary array with four bits each. For the above integer array I would lik

3条回答
  •  天涯浪人
    2020-12-30 10:13

    A late answer I know, but MATLAB has a function to do this directly de2bi

    out = de2bi([3,4,5,6,7], 4, 'left-msb');
    

提交回复
热议问题