We describe a new spectral method for solving matrix-valued Riemann-Hilbert problems numerically. We demonstrate the effectiveness of this approach by computing solutions to the homogeneous Painleve II equation. This can be used to relate initial conditions with asymptotic behaviour