Stuart’s MATLAB Videos

Watch and Learn

Adding a try/catch With Email Notification

One module of a large MATLAB project I maintain failed last night and caused the whole application to error-out. This is disappointing because it takes several hours to run. It was because of a typo I had entered into a string in a spreadsheet; something I might do again.

So I want add a try/catch statement around this piece of code to ensure the system is robust to the issue in the future. Also, because I want to address the root cause of the error (string typos) and the fact that the code runs during the night, I want to send myself an email notification when it fails.

Features covered in this code-along style video include:

  • try/catch, str2func
  • sendmail

Play the video in full screen mode for a better viewing experience. 

|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。