MATLAB: Error Found an interactive session. You cannot have multiple interactive sessions open simultaneously. To terminate the existing session, use ‘delete(gc​p(‘nocreat​e’))’

gcpidletimeoutparallel computingParallel Computing Toolboxparforparpool

Hello everybody,
I want to create a pool but Matlab returns that I have a pool opened. I make sure that if a pool is open close it before open the new one. I mean:
delete(gcp('nocreate')); %delete the current pool
poolobj = gcp;
if isempty(poolobj)
poolsize = 1;
else
poolsize = poolobj.NumWorkers;
end
parpool(poolsize,'IdleTimeout',Inf);
This is my code. I check if a pool is opened and then open a new one.
What is wrong? It always shows that issue.
Thanks!
Javi

Best Answer

I am going to answer my own question if this helps to someone else.
It is not possible to open a pool with gcp and the open again with parpool.
That was the problem
Related Question