function n = baseM2dec(s,M,L)
% baseM2dec - convert a number in base M respresentation to decimal
%
% Convert the base M representation obtained with dec2baseM back to a decimal
% number.
%
% n = baseM2dec(s,M,L)

fact = 1;
n = 0;

for i = L:-1:1
	n = n+s(i)*fact;
	fact = fact*M;
end
