How can I access to variables after a parallel pool?

2 visualizzazioni (ultimi 30 giorni)
Hi,
It's my first time to use the parallel toolbox in matlab, and I have a question about variables here.
My part code is as follows:
c = parcluster('local');
job = createJob(c);
createTask(job, @computeT, 1, {{sub(1),sub(2),sub(3),sub(4),w1,alp1,bet1,Carray,x} ...
{sub(1),sub(2),sub(3),sub(4),w2,alp2,bet2,Carray,x} {sub(1),sub(2),sub(3),sub(4),...
w3,alp3,bet3,Carray,x} {sub(1),sub(2),sub(3),sub(4),w4,alp4,bet4,Carray,x}});
submit(job);
wait(job);
ks = fetchOutputs(job);
delete(job); %line 9
delete(gcp);
clear job;
kp = sum(cell2mat(ks));
rp = 0.5*pi*pi*kp;
tp = x(1)*x(2)*x(3)/(4*pi)*rp;
There are 4 workers on local cluster. After the parallel job, I try to end the pool (lines9,10,11). But I failed, as I cannot find variables kp, rp, tp from my current workspace. How can I access those variables after the parallel pool, please?
Thanks.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by