Given matrix a of size MxN and matrix b of size MxL I want to get a matrix C of size M x(N*L) which contains the column-wise logical operation AND of all combinations of columns of matrix a and matrix b.
a = [1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1]; b= [0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0];C=[];for ii=1:size(a, 2) for jj=1:size(b, 2) C = [C b(:,jj) & a(:,ii)]; endend
I am searching for an alternative syntax of the above loops. Thank you!
Best Answer