How to add a string to a filename while saving plots
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Manal Shakeel
le 18 Avr 2017
Commenté : Manal Shakeel
le 25 Avr 2017
I have a code that runs a for loop through a folder, reads the files, plots certain variables for each file and saves the plot as a png with the filename.
[pathstr,name,ext] = fileparts(file.name); print('-dpng',name,'d');
e.g: For a file called test the plot is saved as test.png
Now I want to plot multiple graphs for the same file and hence save the file as test_angle.png for example.
Any idea how I can do that? In python I can do so using '+'. I tried using strcat and append but I think I am doing something wrong.
0 commentaires
Réponse acceptée
Stephen23
le 18 Avr 2017
Use sprintf and fullfile. You will find a complete explanation here:
Voir également
Catégories
En savoir plus sur Data Type Conversion 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!