How do I set file dependencies in my deployed code that uses Parallel Computing Toolbox 5.0 (R2010b) functions?

2 views (last 30 days)
I am compiling my MATLAB code to be run on a cluster using MDCS, into a Java component. I included the following piece of code in my MATLAB program to add file dependencies to my job.
set(job1, 'FileDependencies',{'C:\MyDirectory\fileName.m'});
By giving this absolute path of the file as file dependency, the code runs fine with the correct outputs on MATLAB. However, when I try to run the deployed version of this code, the job does not run and the result vector is empty as if the job did not execute.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 9 Feb 2011
This behavior is seen because the deployed code is trying to access the original unencrypted version of the file filename.m . In order to avoid this issue, add the file filename.m as an additional file in the CTF archive using -a flag of mcc command or add the file as an additional file in the deploytool project.
Modify the MATLAB code to include the following:
if(isdeployed)
set(jobHandle, 'FileDependencies',{'fileName.m'});
else
set(jobHandle, FilleDependencies',{'C:\MyDirectory\fileName.m'});
end
This enables the deployed code to access the encrypted file that it needs from the current CTF directory specified in the IF part. The MATLAB code continues to access the original file from the absolute path specified in the ELSE part.

More Answers (0)

Products


Release

R2010b

Community Treasure Hunt

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

Start Hunting!