Modified run matlab method to include multiple attempts for an interrupted matlab process.