Code covered by the BSD License  

Highlights from
Converts between decimal integers to multiple based numbers

from Converts between decimal integers to multiple based numbers by Zhigang Xu
Converts between decimal integers to multiple based numbers.

dec=mbase2dec(s, mbase)
function dec=mbase2dec(s, mbase)
% Convert integers in muitiple bases to decimal integers. It is the inverse
% function of DEC2MBASE.
%
% DEX=MBASE2DEC(S, MBASE) has the following inputs and output.
% Inputs:
%    S,    a matrix of size M by N where M is the length of DEC and N
%          is the length of V.
%
%    MBASE, a vector of bases, such that 
%           sum(S.*MBASE(ones(N,1),:),2)==DEC is true, where N=size(S,1).
%    
%    Both S and MBASE should be the outputs of DEC2MBASE.
%
% Output:
%     DEC,   an array of decimal integers.
%      
%
% Example, if s=[7 1 703], mbase=[8192 1024 1] then 
%
%             dec=mbase2dec(s,mbase)
%
% gives dec=59071
%
% See also DEC2MBASE.

m=size(s,1);
dec=s.*mbase(ones(m,1),:);
dec=sum(dec,2);

end

Contact us at files@mathworks.com