"Jason Park" <email@example.com> wrote in message news:firstname.lastname@example.org... > 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