If I understand your question correctly, you should get the desired output using array multiplication -
N=5;
A = (1:N).'
X = magic(N)
Z = A.*X
? (where each row vector in the above matrix X is multiplied by the corresponding part in vector A)Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!