function d = bin2dec(h)
%BIN2DEC  BIN2DEC('X') returns the decimal number corresponding to the
%        binary number in quotes.  
%		 For example, BIN2DEC([1 1 0 0]) returns 12.

n=length(h);
h=fliplr(h);
d=0;
for i=1:n
	if isstr(h(i)),
		p(i) = str2num(h(i)).*(2^(i-1));
	else
		p(i) = h(i).*(2^(i-1));
	end
end
d=sum(p);

