Finite dimensional Wiener-Hopf equations and factorizations of matrices