Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: send an email when codes crash?
Replies: 2   Last Post: May 22, 2013 11:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,944
Registered: 12/7/04
Re: send an email when codes crash?
Posted: May 22, 2013 10:04 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply



"Jason Park" <jason.park@curtin.edu.au> wrote in message
news:kniekm$kdh$1@newscl01ah.mathworks.com...
> Hi,
> Is there a way to prompt Matlab to send an email when the current run
> crashes?


Ideally MATLAB shouldn't crash (unless you write a MEX-file that scribbles
on memory it shouldn't or dereferences a null pointer or the like; when you
write in MEX MATLAB can't stop you from shooting yourself in the foot if you
really want to.) If you can reproducibly crash MATLAB without a MEX-file
you've written in the mix, please send those steps to Technical Support so
we can investigate why it's crashing and hopefully prevent it from doing so
in the future.

> I'm using SENDMAIL but only know how to set it to send off an email when
> it finishes.


If you want MATLAB to send you an error when your program terminates due to
an error, use a TRY/CATCH block.

try
runMyProgram()
sendEmailOnSuccess();
catch
sendEmailOnFailure();
end

You could, if you're using a recent version of MATLAB, even show some
information about the failure in the email.

try
runMyProgram()
sendEmailOnSuccess();
catch theErrorInfo
sendEmailOnFailure(theErrorInfo);
end

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.