LoginSignup
8
8

More than 5 years have passed since last update.

MATLAB上で時間のかかるシミュレーションが終ったら通知して欲しい

Posted at

動機

パラメータを学習させたい!!!けど時間かかる!
いつまでも画面を見ているわけには行かないけど,計算が終わったらすぐ結果を知りたい.
そう,そんな時は終わり次第メールで通知すればいい.

ソース

https://jp.mathworks.com/matlabcentral/answers/93383-how-do-i-use-sendmail-to-send-email-from-matlab-7-2-r2006a-via-the-gmail-server-or-yahoo-server
http://blog.livedoor.jp/itukano/archives/51833649.html

コード

% Modify these two lines to reflect
% your account and password.
email = 'myaddress@gmail.com';    %変更するのは
password = 'password';            %この2行

setpref('Internet','E_mail',email);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',email);
setpref('Internet','SMTP_Password',password);

props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', ...
                  'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');

%ここで sendmail を使ってテストメールを送っている
%ここに設定するアドレスは gmail のものではなくて大丈夫。
%自分の gmail 経由で目的のアドレスにメールが送られてきます
sendmail(email, 'Gmail Test', 'This is a test message.');
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8