How can I let MATLAB know when my shell script is completed its execution so that MATLAB can retrieve results in MATLAB 7.8 (R2009a)?

1 view (last 30 days)
I have a shell script that does computation and produces results. I retrieve these results and does analysis in MATLAB. I want to know if there is any automatic way that I can have MATLAB started to analyze results once the computation from the shell script is completed.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
There is no direct way to do this. You may try the following workarounds:
1. Set your own environment variable and use MATLAB timer to check its value:
You can set your own system-wide environment variable, and set it to a certain value at the end of your program. You can make use of MATLAB timer to check its value at a fixed rate. For this method, you would need to start MATLAB and start the timer with a callback function that checks the value of this environment variable during the execution of your script.
A couple of things to keep in mind:
(1) It is known that an environment variable set using SETENV in MATLAB is only visible within MATLAB on a Windows machine:
<http://www.mathworks.com/support/solutions/data/1-3IOL0N.html>
Please make sure the environment variable you set is visible for other processes.
(2) MATLAB timer:
If you would like more information on MATLAB timer, please refer the following documentation:
- Timer object:
<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f9-38134.html>
- Starting and stopping timer:
<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_prog/f9-38272.html#f9-41266>
2. Call MATLAB within your script:
At the end of your script, you may start MATLAB with '-r' option so that specified MATLAB function can run upon startup. Please refer the following documentation for detailed information:
- Starting MATLAB on UNIX platforms:
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabunix.html>
- Startup options:
<http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_env/f8-4994.html>
<http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_env/f8-4994.html>

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!