Hira Noor
Newbie level 1
function bindat = text2bin(text)
temp1 = dec2bin(double(text));
temp2 = reshape(temp1,1,[]);
for i = 1:length(temp2)
if temp2(1,i) == '0'
bindat(i) = 0;
else
bindat(i) = 1;
end
end
this is the function file for converting any text into binary... i want to ask that how to do the zero padding in the binaray data , as if we want to set the limit to 100 characters but user enters only 60 characters so the program pads 40 zeros to make them 100..
temp1 = dec2bin(double(text));
temp2 = reshape(temp1,1,[]);
for i = 1:length(temp2)
if temp2(1,i) == '0'
bindat(i) = 0;
else
bindat(i) = 1;
end
end
this is the function file for converting any text into binary... i want to ask that how to do the zero padding in the binaray data , as if we want to set the limit to 100 characters but user enters only 60 characters so the program pads 40 zeros to make them 100..