MATLAB: Converting decimal matrix to binary matrix

binarydecimalimage processingmatrix

I wish to convert a matrix of decimals to a matrix of binary numbers.
For example, if M = [ 1 25 34 9 ]
I then want, M = [ 00000001 00011001 00100010 00001001]
I got the output for the following matrix M=[6 5;1 3] from the below code.,but it doesn't work on the above matrix
% M=[6 5;1 3];
% b=dec2bin(M');
% b=b';
% b=str2num(b(:));
% b=reshape(b,8,2)'
*Any help/pointers would be appreciated.*

Best Answer

M = [ 1 25 34 9 ]
out=cellstr(dec2bin(M,8))'