|
"Andreas " <andreas.koch1@gmx-removethis.de> wrote in message <hks0b4$fl9$1@fred.mathworks.com>...
> Hello all,
>
> I'm calling some Fortran code from within a matlab loop, which usually takes ca. 10 seconds to run through per run. The whole program is set up like this:
>
> nmc = 1e3;
> while nrun < nmc
> nrun = nrun +1;
> !echo -e "orbitinp.tmp\n-100" | ./orbit
> % Followed by lots of stuff to evaluate the output from ./orbit
> end
>
> Sometimes the "orbit" code freezes, though, so I would like to kill it from within matlab if that happens. Is there a way to set something like a process-time threshold so that I could say
>
> %tic
> !echo -e "orbitinp.tmp\n-100" | ./orbit &
> if time > threshold
> continue
> end
>
> Thanks for any tip or alternative ideas.
> Andreas
Maybe overkill, but...
Have your process take a numerical argument. Pass that value to alarm() and have a signal trap ready for SIGALRM, which quits the process.
|