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에서 Parallel Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by