MATLAB: How to convert an array of decimal values to binary

arraybinarybitcellconvertdecimaleachnumericalposition;

Hi everyone,
I have a very large array read from a file:
x = [0 0 0 2 0 3 0 1 0 0 ….]'
This values correspond to symbols from QPSK demodulation and I need to convert the array to binary so that the result is:
x_bin = [0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 ….]'
I tried using x_bin = cellstr(dec2bin(x,2)) but what I get is this cell array with 2 bits in each position:
x_bin = [00 00 00 10 00 11 00 01 00 00 …]'
I need a numerical array (not a cell array) with 1 bit in each position like the one above.
Is there any way to achieve this?
Thank you in advance!

Best Answer

>> x = [0 0 0 2 0 3 0 1 0 0];
>> c = dec2bin(x(:),2);
>> reshape(c.',1,[])-'0'
ans =
0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0