Exit with non zero exit 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 exit a non-zero return code if an error is captured. This should cause the corresponding training example job to fail.