Run parallel function.
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HI all,
I have one function with different input values
function chooseDirectionRolling(Coord,Arrow)
for i=1:100
doRolling(Coord,Arrow); %an example of other function
Coord=Coord+i;
end
end
I want to run this function for four direction at the same time, when I do as below, it takes times
chooseDirectionRolling(rightCoord,rightArrow);
chooseDirectionRolling(leftCoord,leftArrow);
chooseDirectionRolling(upCoord,upArrow);
chooseDirectionRolling(downCoord,downArrow);
Q: How can I run at the same time for one function with different input variables?
I tried to used parfor but it did not work.
0 Kommentare
Antworten (1)
Hari Krishna Ravuri
am 5 Dez. 2019
I understand that, you want to execute four functions parallely.You may consider using parfeval.The syntax of parfeval is
F = parfeval(p,fcn,numout,in1,in2,…)
Please refer https://in.mathworks.com/help/parallel-computing/parallel.pool.parfeval.html for more information on parfeval.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Asynchronous Parallel Programming 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!