Error using copyfile, Cannot write to destination

158 visualizaciones (últimos 30 días)
Jelle Kramer
Jelle Kramer el 21 de Oct. de 2021
Respondida: Bryant Lash el 21 de Oct. de 2021
Really hoping someone can help. Matlab (version 2021b) seems unable to write to destination folders. When using the
copyfile
command, I get the following error in my command window:
Error using copyfile
Cannot write to destination: C:\Users\...
Use the 'f' option to override.
Where of course the dots (...) represent the actual folder that Matlab is trying to write to. It would be really helpful if someone could help me fix this error. Thanks in advance!

Respuestas (1)

Bryant Lash
Bryant Lash el 21 de Oct. de 2021
So it's telling you what to do in that function. In stead of using
copyfile(source,dest);
you have to use
copyfile(source,dest,'f');
to force the copy. If that doesn't work, then the issue is that matab doesn't have the right permissions and you'll have to open matlab as admin.
If that still doesn't work, I imagine windows can't copy there either and it's a great lock that windows is placing on that location - there's nothign (reasonable) that can be done about it from matlab.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by