Save run a .m file and rename a file in a loop
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
yue ishida
le 6 Juil 2017
Réponse apportée : Walter Roberson
le 6 Juil 2017
Hi. I want to ask. Is there anyway to run a .m file and rename a saved file by increment the number in the end of name, like version number in a loop, about 30 times. For example, I want to run A.m, and rename saved file results.mat as results1.mat. When another round, results.mat will rename as results2.mat, and so on.
0 commentaires
Réponse acceptée
Walter Roberson
le 6 Juil 2017
oldname = 'results.mat';
for K = 1 : 30
run('A.m');
newname = sprintf('results%d.mat', K);
movefile(oldname, newname);
end
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Adding custom doc dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!