MATLAB: Offset matrix multiplication with loop

for looploopmatrixmatrix multiplication

Hello,
I have two matrices A(i,j) and B(i,j) where 'i' is row and 'j' is column both of size 1486X41. I am trying to use a loop to multiply the two together such that the first term in each column of A is skipped, I.E. multiply A(2,1) with B(1,1) to give C(1,1) and then A(3,1) with B(2,1) for C(2,1) and so on. The final matrix size will be now 1485X41. I've attempted using a for loop but I struggle with thinking through the code. So far my efforts have led me to:
for i = 1:(length(A)-1)
at = A(i+1)-A(1)
C = B*at
end
I hope my question is clear, and I apologize in advanced for any confusion with the wording. Thank you.

Best Answer

% test data
A = randi(10,3,4)
B = cumsum(ones(size(A)))
% engine
C = A(2:end,:) .* B(1:end-1,:) % C(i,j) = A(i+1,j) * B(i,j)