Exit with non zero return code if a Matlab training example fails

We do not have any proper Matlab integration tests at the moment but daily run the training examples job against the latest server.

This PR causes all the Matlab training scripts to return a non-zero return code if an error is captured. This should cause the corresponding training example job to fail.