Job not returning values
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Antworten (1)
Jason Ross
am 13 Mär. 2012
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 Kommentare
Jason Ross
am 14 Mär. 2012
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.
Siehe auch
Kategorien
Mehr zu Parallel Computing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!