MATLAB: Dividing every element in a row from a 2×2 matrix by an element from same row from a 2×1 matrix

MATLABmatricesmatrix

I have two matrices
A=[10,20;20,10]
B=[2;5]
And i want to divide them in such a way that i get a 2×2 matrix like so
(10/2 20/2)
(20/5 10/5)

Best Answer

C = bsxfun(@rdivide,A,B);