One may try
newvector = bsxfun(@(j,k)(func(A(j,:),B(k,:)),1:na,(1:nb)');
Note this trick cannot be applied to sparse matrices.
One may try
newvector = bsxfun(@(j,k)(func(A(j,:),B(k,:)),1:na,(1:nb)');
Note this trick cannot be applied to sparse matrices.