Asked by Ahmed almansory
on 14 Apr 2013

*No products are associated with this question.*

Answer by Cedric Wannaz
on 14 Apr 2013

Edited by Cedric Wannaz
on 14 Apr 2013

Accepted answer

b_ext = repmat(b, 1, size(a, 2)) ; c = a + b_ext ;

Answer by James Tursa
on 14 Apr 2013

bsxfun(@plus,a,b)

Cedric Wannaz
on 14 Apr 2013

+1

I don't understand why it is slower than REPMAT though in cases where size(a,2) is not too large .. I thought that it would kill repmat when I tested.

James Tursa
on 14 Apr 2013

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments