
Re: Multiplying each colum of my matrix by a constant
Posted:
Jun 15, 2013 3:54 AM


"Steven_Lord" <slord@mathworks.com> wrote in message > > > > If I understand you correctly, this should do what you want: > > > > M*diag(v) > > That works in this 3by3 case, but you wouldn't want to do this for a very > large matrix M and a correspondingly long v
Using sparse matrix will work fast in any case
n = size(M,2) M * spdiags(v(:),0,n,n)
% Bruno

