Exit with non zero exit code if a Matlab training example fails
Encapsulate all graphical displays in if statements in RenderImages

As it stands, running RenderImages in a non-graphical MATLAB session will fail
when trying to use imshow(). This commit fixes this behaviour by only
displaying images and thumbnails in graphical mode.
Rethrow error instead of exiting the script if an error is catched
Move the final closeSession() into a final try/catch statement

Drop the throw(err) approach as it does not work with command-line script
calling. Instead fill the value of the return code so that the examples can be
called as follows:
matlab -nodisplay -nosplash -nodesktop -r "script; exit(rc)"
Do not expose return codes in simple Matlab examples

- Falls back to the exception throwing strategy for individual examples
- Add an exampleSuite.m script wrapping up all the examples in a try/catch
  block, outputting the error message and exiting with a non-zero error code
  if one of the examples fails.
Merge pull request #1426 from sbesson/rebased/develop/matlab_training_rc

Exit with non zero return code if a Matlab training example fails (rebased onto develop)