2010-08-11 getting the PID from matlab

2010-08-11 07:45:20
  • I need the pid to know if one of the many simulations I run are still running. There's no native solution in matlab to my knowledge.
  • using hint @ http://www.mathworks.cn/matlabcentral/newsreader/view_thread/268529
  • create getpid.c with
    1 #include "mex.h"
    2 #include <unistd.h>
    3 mexFunction(int nlhs, mxArray *plhs[ ], int nrhs, const mxArray *prhs[ ])
    4 {
    5   plhs[0] = mxCreateDoubleScalar((double) getpid());
    6 }
  • compile with mex getpid.c 
  • use in matlab as pid = getpid()
  • this is part of the package in SparseHebbianLearning

Comments

Comments powered by Disqus