getting the PID from matlab

  • 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.

Warning

This post is certainly obsolete...

  • 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 ``

    System Message: WARNING/2 (<string>, line 22); backlink

    Inline literal start-string without end-string.

  • use in matlab as pid=getpid()

  • this is part of the package in SparseHebbianLearning

Comments

Comments powered by Disqus