Can't create/open txt files
Afficher commentaires plus anciens
The title pretty much sums it up. I want to use fopen to create or open a file and it is just returning -1 everytime. It seems like Matlab has not the rights to do that but I don't understand why.
I am administrator, I tried running Matlab as admistrator and I know I am in the right folder.
9 commentaires
dpb
le 18 Fév 2021
Return the option message argument to see what the error returned is...and show us code/error messages in context, don't just describe to us. May be overlooking some clue.
What happens for trying to edit/save a file in editor or writing a file with, say, writematrix that just takes a filename? Do they fail as well?
Theo Y
le 18 Fév 2021
dpb
le 18 Fév 2021
"What happens for trying to edit/save a file in editor or writing a file with, say, writematrix that just takes a filename? Do they fail as well?"
Out of curiosity, what does
cd
return?
Theo Y
le 18 Fév 2021
dpb
le 18 Fév 2021
What about
!attrib D:\Work
!attrib D:\Work\Stage
??
Theo Y
le 18 Fév 2021
Theo Y
le 18 Fév 2021
dpb
le 18 Fév 2021
Indeed, looks strange.
wd='D:\Work\Stage';
[stuff,msg] = fopen(fullfile(wd,'filename.txt'),'w')
??
Theo Y
le 18 Fév 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Import and Export dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!