
function C = matProd(A,B)

if nargin ~=2
   error('Requires two inputs: The two inputs must be a NxM and MxP numerical array') 
end

if ndims(A)>2
    error('Requires 2D matrix: The two inputs must be a NxM and MxP numerical array') 
end

if ndims(B)>2
    error('Requires 2D matrix: The two inputs must be a NxM and MxP numerical array') 
end

[Arow,Acol] = size(A);
[Brow,Bcol] = size(B);

if Acol ~= Brow
   error('Matrix inner dimensions must agree: The two inputs must be a NxM and MxP numerical array') 
end

if ~isnumeric(A)
   error('Data type must be numeric: The two inputs must be a NxM and MxP numerical array') 
end

if ~isnumeric(B)
   error('Data type must be numeric: The two inputs must be a NxM and MxP numerical array') 
end


C = zeros(Arow,Bcol);

for ii = 1:Arow
    
   for jj = 1:Bcol
      
       C(ii,jj) = sum(A(ii,:).*B(:,jj)');
       
   end
    
end

end

