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

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.

 採用された回答

MathWorks Support Team
MathWorks Support Team 2015 年 2 月 27 日
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.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で MATLAB Compiler SDK についてさらに検索

製品

リリース

R2009b

Community Treasure Hunt

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

Start Hunting!

Translated by