MATLAB: Matrix multiplication using bsxfun(@times,a,b)

bsxfunMATLAB

a=[1 0 0 1 0 1 1
0 1 1 1 0 0 1
1 0 0 1 1 0 0
1 0 0 0 1 0 1
1 1 0 0 0 1 0
0 1 0 0 0 1 1]
b=[0 1 0
0 1 0
1 0 0
0 0 1
0 0 1
0 0 1
0 0 1]
c=bsxfun(@times,a,b)
but it is giving error
Error using bsxfun
Non-singleton dimensions of the two input arrays must match each other.
how to multiply (6×7) matrix with (7×3) to get a matrix(6×3)

Best Answer

Not sure if this is the operation you really want from your description:
a = 6x7 matrix
b = 7x3 matrix
c = a * b; % 6x3 matrix