MATLAB: Creating a custom parallel pool leads to fetchNext error

Parallel Computing Toolbox

I created a parallel pool with 11 workers. I have a PC with 6 cores and 12 logical processors.
parpool('local11',11);
`gcp` does return the pool.
>> p = gcp();
>> p
p =
Pool with properties:
Connected: true
NumWorkers: 11
Cluster: local
AttachedFiles: {}
IdleTimeout: 30 minute(s) (24 minutes remaining)
SpmdEnabled: true
When `fetchNext(ff)` is called, it errors out with:
parallel:fevalqueue:FetchNextUnequalQueues
fetchNext can only be used on Futures submitted to the same parallel pool.
C:\Program Files\MATLAB\R2016a\toolbox\distcomp\cluster\+parallel\@FevalFuture\FevalFuture.m, FevalFuture.fetchNext, 210
The function was created with `ff(i) = parfeval(p, @myfunc,` ` where `p = gcp();`.
Any idea why I'm getting that error?

Best Answer

Lesson learned: if you create a new parallel pool, `clear` the workspace.