MATLAB: Issue in matrix multiplication

matlab function

G=[1 1 1 1 1 0 0 0 1 0 0 0; 0 0 1 1 0 0 0 1 0 1 0 0; 1 1 1 0 1 0 0 1 0 0 1 0; 1 0 0 1 1 1 0 1 0 0 0 1];
m=[1 0 1 0]
how to multiply them??

Best Answer

G is 4x12 and m is 1x4, then two possibilities :
m*G
G'*m'
You do not get binary result because of the multiplication cij=sum a_ik b_kj there is an addition. you can get binary results if the matrices have the same dimensions and you use Hadamard product :
m=m'
M=zeros(4,12);
for n=1:12
M(:,n)=m;
end
M.*G