I need to convert a Decimal Number to a Binary Vector
For example, Something like this:
length=de2bi(length_field,16);
Unfortunat
Are you using this for IEEE 802.11 SIGNAL field? I noticed "length_field" and "16". Anyway here's how I do it.
function [Ibase2]= Convert10to2(Ibase10,n)
% Convert the integral part by successive divisions by 2
Ibase2=[];
if (Ibase10~=0)
while (Ibase10>0)
q=fix(Ibase10/2);
r=Ibase10-2*q;
Ibase2=[r Ibase2];
Ibase10=q;
end
else
Ibase2=0;
end
o = length(Ibase2);
% append redundant zeros
Ibase2 = [zeros(1,n-o) Ibase2];