MATLAB: Matrix Multiplications (Altar Output Matrix Size)

arithmaticMATLABmatrix manipulationmatrix operation

I have a matrix of 100×10 multiplied with a matrix of 1×10. I need to get 100×10 values out as the result. Currently i only get 1×10 values as the ans. How could i modify the terms accordingly?
for i=1:1:100
for k=1:1:10
c1 = data(i,k) * p(1:k);
end
end
Also, are there any "computationally efficient" alternatives to a for loop in this case?
Please Advise. Thanks!

Best Answer

c1 = bsxfun(@times,A,B);
Related Question