Permission to write into text file
Mostrar comentarios más antiguos
Hello
I got the following error below:
Permission denied : I am unable to open file mojo.txt
find the code below
function savechangeptsButtonPushed(app, event)
writematrix(app.UITable.Data, 'mojo.txt')
end
end
What do I do to solve the issue
Thanks in advance
6 comentarios
Rik
el 9 de Jul. de 2019
What is the current folder during that call? Are you sure you have write access in the first place?
Tino
el 9 de Jul. de 2019
Geoff Hayes
el 9 de Jul. de 2019
Tino - try creating and writing the file to a different folder (one where you have read and write permissions).
dpb
el 9 de Jul. de 2019
Use debugger and ensure you're where you think you are when the callback executes...it appears there are no returned optional diagnostic messages available from writematrix to give any additional klews like what can help from fopen and friends.
In fact, using fopen instead with the optional error return might be of interest/benefit.
Guillaume
el 9 de Jul. de 2019
Another possibility is that the file is already opened (with write access) by some other program. In any case, matlab just asks the OS to open the file for write access. It's the OS that tells matlab it's not possible. Nothing matlab can do anything about.
dpb
el 9 de Jul. de 2019
"...Nothing matlab can do anything about."
Other than trap the OS error and report it which may (or may not) be more informative to the user than just "I can't do that!" and die.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre File Operations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!