Save a matrix .mat in a specific folder with a variable name
Afficher commentaires plus anciens
I would like to save a matrix as a .mat file in a specific folder. The save function is located at the end of a for loop and, therefore, it is needed to be saved with a variable name changing each loop iteration. At the moment I am able to save the .mat file in a specific folder but I am not able to save it with the desired variable name. I am now using this function:
save('filepath','variablename')
where the variablename is the name of the .mat file that needs to be saved.
Thank you all!
Réponse acceptée
Plus de réponses (1)
dpb
le 4 Jan 2022
save(filepath,'variablename')
The functional form of save needs the file name to be the variable containing the (hopefully fully-qualified) desired filename, the variable name must be the literal string matching the variable to be saved.
1 commentaire
Emilio Pulli
le 4 Jan 2022
Modifié(e) : Emilio Pulli
le 4 Jan 2022
Catégories
En savoir plus sur File Operations 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!