Effacer les filtres
Effacer les filtres

Put a variable in a file title name

4 vues (au cours des 30 derniers jours)
yusra Ch
yusra Ch le 18 Oct 2020
Commenté : yusra Ch le 18 Oct 2020
Hello,
I want to run a for loop that has an id=1:100 and at the end of each iteration I want matlab to save the results under a file name "Trace_id". So at the end of the programe I will have files called Trace_1 , Trace_2 ,etc...
Thank you

Réponse acceptée

Ameer Hamza
Ameer Hamza le 18 Oct 2020
Modifié(e) : Ameer Hamza le 18 Oct 2020
Something liks this
for id=1:100
% do your processing
M; % matrix to write to file
filename = sprintf('Trace_%d', id);
writematrix(M, filename)
end
  3 commentaires
Ameer Hamza
Ameer Hamza le 18 Oct 2020
@Vladimir, thanks for pointing out.
yusra Ch
yusra Ch le 18 Oct 2020
Thank you guys for your help, I really appreciate it

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