Answer:
Here is the code in Matlab for the function.
I have also attached the m file for function as well as the test run of the code here and screenshot of the result.
Code:
function [ C ] = columnproduct( A, B )
% get the dimesnions of A
sizeA = size(A);
sizeB = size(B);
% check if columns of A are same as rows of B
if(sizeA(2) ~= sizeB(1))
error('matrix dimensions do not match')
end
% initialize resultant matrix
C = [];
for i = 1:sizeB(2)
% concatenating product of matrix A with each column of B
C = [C A*B(:,i)];
end
end