Job not returning values

2 次查看(过去 30 天)
Sampath reddy
Sampath reddy 2012-3-13
sched=findResource('scheduler','type','local');
pjob=createJob(sched);
createTask(pjob,@decoder_direction_and_count_with_fm_signal,2,{1});
createTask(pjob,@p2,2,{150});
submit(pjob);
tic
waitForState(pjob);
toc
data=getAllOutputArguments(pjob);
destroy(pjob);
function [count,pulse]=decoder_direction_and_count_with_fm_signal(tmax)
clear all;
close all;
tic
f=100000;
t=0:1/f:tmax;
n=length(t);
a=sin(40*sin(2*pi*400*t)+2*pi*300*t);
b=cos(40*sin(2*pi*400*t)+2*pi*300*t);
f=a>0;
g=b>0;
count =0;
y=ones([1 n]);
pulse=zeros([1 n]);
pr=circshift(g,[1 -1]);
for i=1:n,
if i==1
j=1;
else
j=i-1;
end
if pr(1,i)~=g(1,i)
y(1,i)=xor(f(1,i),pr(1,i));
else
y(1,i)=y(1,j);
end
end
for i=2:n,
if f(1,i)~=f(1,i-1)
pulse(1,i)=pulse(1,i-1)+1;
else
pulse(1,i)=pulse(1,i-1);
end
if y(1,i)~=y(1,i-1)
count=count+1;
pulse(1,i)=0;
end
end
toc
function [b,i]=p2(m)
tic
n=200;
b=zeros(n,1);
for i=1:n,
b(i)=b(i)+max(eig(rand(m)));
end
disp('p2');
toc
Why is the return values of decoder_direction_and_count_with_fm_signal function not being returned in the above program?

回答(1 个)

Jason Ross
Jason Ross 2012-3-13
You get the outputs from the job in
data=getAllOutputArguments(pjob);
But you never do anything with "data" to display the results.
e.g.
>> data = pjob.getAllOutputArguments
data =
'task one output'
'task two output'
>> data = pjob.getAllOutputArguments;
  4 个评论
Sampath reddy
Sampath reddy 2012-3-14
I have a problem to solve.. ,it will be helpful if u can help.
I have 3 functions or programs which are to be run simultaneously on a quad core processor such that function1 is to be run on core0, function2 on core1 and function3 on core2 and core3 is left for other processes.
Please help if u can.
Jason Ross
Jason Ross 2012-3-14
I regret that I don't have the time to step through and debug your code -- I have some projects I must make progress on for my daily work. You really should be able to find where the error is with standard debugging techniques.
Also, there is no guarantee of what core your task is going to end up executing on. That is left up to the operating system entirely.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 MATLAB Parallel Server 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by