Can we use parfor inside a for loop?

9 vues (au cours des 30 derniers jours)
Sampath reddy
Sampath reddy le 14 Mar 2012
Can a parfor loop be used in side a for loop. I want to run a series of iterations with parfor inside the for loop. How to do this?

Réponses (2)

Sean de Wolski
Sean de Wolski le 14 Mar 2012
Sure!
matlabpool open 2
for ii = 1:3
parfor jj = 1:3
disp([ jj ii])
end
end
matlabpool close

Konrad Malkowski
Konrad Malkowski le 19 Mar 2012
If you have multiple nested for loop, then for best performance you really want the parfor to be the outermost loop in your program.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by