we are using a library that adds folders to the Matlab path. In addition we have an external build system that tries to delete temporary folders before building mex-Files and copying Simulink and Matlab files. For an unknown reason, Matlab prevents the removal of these folder as long they are on the Matlab path. I tried bdclose('all'), clear functions, clear mex, clear all, nothing helps. Why is Matlab preventing the removal?
I also tried to reproduce it manually. But than it works. It happens only with folders that have been added by this library.