Is there a simple way to write a for loop in matlab such that below a certain number (n) of iterations it is a normal for-loop, whereas above this threshold it is a parfor loop?
I want to reduce the overhead that is associated to creating a parallel pool. I tried to set the number of workers to 1 (for less than n-iterations) but still the overhead is non-negligible.
if n > 100, parfor ... else, for... end
, or just start the pool in advance?