function out = convert(x)
% converts x to a binary number
if x == 0 out = '0';
elseif x ==1 out = '1';
else
 if mod(x,2) == 1
    lb = '1';
 else lb = '0';
 end;
 rest = floor(x/2);
 out = strcat(convert(rest), lb);
end;
end
