Why does my MATLAB program calling distributed jobs fail when compiled as a COM component using MATLAB Builder NE 3.0.2 (R2009b)?
1 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2010-3-16
编辑: MathWorks Support Team
2015-2-27
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
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!