Why does my MATLAB program calling distributed jobs fail when compiled as a COM component using MATLAB Builder NE 3.0.2 (R2009b)?

1 view (last 30 days)
I have a MATLAB program which submits a distributed job.
function output1 = MainJobSumbitFunction
setmcruserdata('ParallelConfigurationFile','jm1.mat');
load (getmcruserdata('ParallelConfigurationFile'));
sched = findResource('scheduler','type',Values.findResource.Type,'LookupUrl', Values.findResource.LookupURL,'Name',Values.findResource.Name);
% Create a job
job = createJob(sched);
job.FileDependencies = {'simpleFunction.m'};
t1 = createTask(job,@simpleFunction,1,{12});
submit(job);
waitForState(job);
output1 = get(t1,'OutputArguments');
destroy(job);
clear java
Where simpleFunction.m is as follows:
function out = simpleFunction()
out = rand(2);
When I compile the above program into a COM component using MATLAB Builder NE 3.0.2 (R2009b), which is called from Excel/VBA, I am seeing unexpected behavior.
I am able to compile the above program into a standalone executable and run it without issues. However, when I compile this code as a COM component that is called from a VBA script in Excel, the job submits, but hangs in pending.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Feb 2015
This issue may be related to the visibility of the compiled components functions to the workers.
To workaround this issue:
1) Extract the CTF files to a network drive (visible to the workers). In order to set up the CTF extraction to a network drive, set an environment variable called MCR_CACHE_ROOT to a directory on the network.
2) Remove the "clear java" command from the MATLAB program.

More Answers (0)

Products


Release

R2009b

Community Treasure Hunt

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

Start Hunting!