## Matrix Division: Different sized matrices

### Articat (view profile)

on 7 Jun 2019
Latest activity Commented on by Jan

on 10 Jun 2019

### Walter Roberson (view profile)

I have one matrix A = [745 678]. I have another matrix B = [745 1].
I want to compute A / B. I want the result to be a [745 678] matrix. So basically every row in A (from 1 to 678) will be divided by the column matrix B. The end result will be all the matrix elements of A divided by the matrix elements of B.

### Walter Roberson (view profile)

on 7 Jun 2019

In R2016b or later,
A ./ B
In earlier releases,
bsxfun(@rdivide, A, B)

Jan

### Jan (view profile)

on 7 Jun 2019
@Lane: Then please post the failing code. The suggestions of Walter and John do work:
A = rand(745, 678);
B = rand(745, 1);
C = A ./ B; % >= Matlab R2016b
D = bsxfun(@times, A, B); % All Matlab versions
Articat

### Articat (view profile)

on 10 Jun 2019
Was able to figure it out by using the function repmat()
Jan

### Jan (view profile)

on 10 Jun 2019
@Lane Dillon: repmat is most likely the least efficient method to solve the problem.