change matrix to boolean