MATLAB: Where do I put the own personal functions when using the Distributed Computing Toolbox 1.0.2 (R14SP3)

foundParallel Computing Toolboxundefundefined

All of the examples in the documentation use built-in MATLAB functions. I would like to call my own functions that I have written.

Best Answer

This enhancement has been incorporated in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
On UNIX, if you wish to call the function /home/user1/myfunc.m, you would need to perform the following steps:
Inside /usr/local/jobstartup.m, add the following code:
addpath('/home/user1')
The function myfunc.m might be:
function x = myfunc(a, b, c)
x = a + b + c;
After jobstartup.m is modified and myfunc.m is saved, you can execute the following command to call this function:
y = dfeval('myfunc', {1}, {2}, {3}, 'JobManager', 'MyJobManager', 'FileDependencies', {'/usr/local/jobStartup.m '});
On Windows, if you wish to execute \\home\user1\myfunc.m, you would need to perform the following steps:
The function that is to be used, myfunc.m in this example, must be located on a shared network drive that all machines can access by using a UNC path.
Inside C:\myfiles\jobstartup.m, add the following code:
addpath('\\home\user1\myfunc.m ')
The function myfunc.m might be:
function x = myfunc(a, b, c)
x = a + b + c;
After jobstartup.m is modified and myfunc.m is saved, you can execute the following command to call this function:
y = dfeval('myfunc', {1}, {2}, {3}, 'JobManager', 'MyJobManager', 'FileDependencies', {'C:\myfiles\jobstartup.m'});