help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applying each element of a vector to each row of a matrix


From: Jaroslav Hajek
Subject: Re: Applying each element of a vector to each row of a matrix
Date: Mon, 20 Dec 2010 20:42:21 +0100

2010/12/19 Jordi Gutiérrez Hermoso <address@hidden>:
> I'm often found with a situation in which I have some matrix A and
> some vector v and I would like to do something like multiply each
> column or row in A by each element of v. I've wished that something
> like A.*v or v.*A would do this if the row or column dimensions of A
> matched those of v, but of course this doesn't work. I end up
> resorting to repmat instead to turn v into a matrix whose dimensions
> match those of A.
>
> My questions are, is there another way to do this more cleanly without
> first calling repmat? If there isn't, would this be a reasonable
> extension of the elementwise operators?
>
> Thanks in advance,
> - Jordi G. H.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>

help bsxfun



reply via email to

[Prev in Thread] Current Thread [Next in Thread]