modified matrix gen to output binary numbers