MATLAB: Error when packaging a toolbox

MATLABtoolbox

Hello,
I have encountered this error multiple times now, and although I somehow seem to get it fixed, I never know how.
I have one folder containing all files of a toolbox. When matlab analyses for dependencies outside the folder, it doesn't find any (as it should).
I have no clue why that happens, or how I sometimes seem to get around it.
I get an error saying that the toolbox packaging failed.
The resulting log-file:
"Beginning packaging process…
Packaging Failed
Failed to add files to 'C:\Users\Merkur\AppData\Local\Temp\tp0f62aa35_cf11_4e20_97b8_20689e0f1591.mltbx': File system entry already exists: /C__/Program Files/MATLAB/R2020a/toolbox/matlab/demos/why.m"
I have no clue what to do. I don't think brute-force repeating the process till it works is the way to go, although it did kinda work so far.
Yes, I did try restarting matlab, my pc, closing all scripts inside matlab before packaging, creating a new toolbox project instead of modifying the older project file when updating. I tried adding basically my entire drive as paths, and probably a few other things I can't remember right now.
For me, the error message doesn't really help. What I did notice is, that when repeating the process, the string of numbers and letters inside Temp\ is changing. If I try to look for the file, it doesn't exist.
Thank you.
Have a great day & stay safe
Claudius Appel

Best Answer

  • As it hasn't occurred since doing so, I'll move my content to answer as it seems to solve the problem:
    For future ref: I don't know if this was me solving the problem, or just getting lucky as it seemed to be in the past, but I copied all files into a completely separate folder which isn't in the AppData\...-path, made that my current folder, and then packaged it afterwards. It might be that matlab just doesn't allow packaging a folder on the AppData-Path, but I don't know if that is true.