Effacer les filtres
Effacer les filtres

Save variables in a new directory (not current directory)

69 vues (au cours des 30 derniers jours)
Antonio
Antonio le 23 Oct 2012
Modifié(e) : Marta G le 11 Fév 2020
Hi. I'd save variables from the workspace into a file putting it into a new directory (not the curr dir). I use the command 'save' but it doesn't it! Thanking you for your attention, I'm looking forward for your answers.

Réponse acceptée

Thomas
Thomas le 23 Oct 2012
Modifié(e) : Thomas le 23 Oct 2012
you have to use save with the entire path..
save('C:\My folder\filename','varname')
You could also look at the FULLFILE comamnd
doc fullfile
  3 commentaires
Marta G
Marta G le 10 Fév 2020
Modifié(e) : Marta G le 11 Fév 2020
I know this is an old post, but i would like to add that right now it not necessary to add full path if you want to save in a subfolder
save('subfolder\filename','varname');
That subfolder has to be created beforehand.
Walter Roberson
Walter Roberson le 10 Fév 2020
We really recommend using fullfile instead of constructing folder names using strcat. It makes it easier to get the right path and makes the code more portable.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur File Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by