This is a guest post by Kyle Kloster, one of the students I’m working with at Purdue University. Kyle has been doing some large, long running experiments on big graphs. He writes:
The random-walk transition matrices for Twitter, LiveJournal, and Friendster can take several minutes just for matlab to load. The actual experiments we carry out (computing columns of the matrix exponential) can take hours, and this week I got tired of checking in every 10 minutes to see if Matlab had finished (or crashed).
We asked around a bit on Twitter to see if anyone knew how to have Matlab email you when something finishes. Thanks to @jimfonseca for pointing us to the perfect Matlab documentation on sending email. (And also, this documentation on how to use gmail to send email in Matlab.) We used this documentation to build the matlabmail function.
MATLABMAIL( recipient, message, subject ) sends the character string stored in 'message' with subject 'subject' to the address in 'recipient', from the email address stored in the file. This requires that the sending address is a GMAIL email account.
One troubling part is that you need to tell Matlab the password to the account that you want to use as “sender”. David suggested creating a dummy gmail account that the whole research group could use as a sender — this way we can use a randomly generated password for one shared account to spare each of us having to use personal login info.
Now having one line of code at the end of a matlab file alerts me when a trial is over!
matlabmail('XXXXXX@purdue.edu', 'twitter experiment done', ... 'subjectline here');
It’s even possible to attach files using these commands, in case you’d like Matlab to send you a JPEG containing the results from your latest experiments.
Note that the function works for gmail accounts only, and it won’t work for gmail accounts that have “2-step verification” enabled.