|
From: | Nicholas Jankowski |
Subject: | Re: Vectorization question |
Date: | Fri, 16 Oct 2015 12:44:41 -0400 |
Vectorization question: say I have a matrix A = (a11, a12; a21, a22) and
a vector B = (b1, b2, b3). I want to generate a matrix 2x2x3 C such that
C(:,:,i) = A + b(i). How can I do this without recurring to a for loop?
With repmat I can easily generate the 2 x 2 x 3 array containing copies
of A but how do I add b(i) to each (:,:,i)?
[Prev in Thread] | Current Thread | [Next in Thread] |