move txt file from one folder to another
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alberto Acri
el 23 de Nov. de 2022
Editada: Florian Bidaud
el 23 de Nov. de 2022
Hi. I am trying to save a .TXT file inside a certain folder. I am currently using this code, but something is not working....
destdirectory = 'C:\Users\....\FolderN'
A = 300;
save(fullfile(destdirectory, 'A.txt'), 'A'); % ???
I had also thought of saving it in the current folder and moving it to the desired folder with 'movefile' but to no effect:
A = 300;
writematrix(A, 'A.txt')
destdirectory = 'C:\Users\....\FolderN';
movefile('A.txt', 'destdirectory');
0 comentarios
Respuesta aceptada
Florian Bidaud
el 23 de Nov. de 2022
Editada: Florian Bidaud
el 23 de Nov. de 2022
Hi,
There is an error in your code, you've added quotes around your variable name. This should work.
A = 300;
writematrix(A, 'A.txt')
destdirectory = 'C:\Users\....\FolderN';
movefile('A.txt', destdirectory);
Alternativeley, you can use writematrix to create and write into a txt file :
writematrix(A,fullfile(destdirectory,'A.txt'))
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!