Using variable names for saving data
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Sudipta Ray
il 29 Giu 2015
Commentato: Sudipta Ray
il 30 Giu 2015
I am running a for loop for parametric sweep. After each loop, the data is to be saved within a .mat file using the 'save' command. How do I provide the function names so that each parameter gets its own .mat file after each loop completion?
0 Commenti
Risposta accettata
Walter Roberson
il 29 Giu 2015
for K = 1 : 20
filename = sprintf('data%04d.mat', K);
save(filename, 'VariableName');
end
If you have more than 9999 iterations then increase the 4 to the maximum number of digits you need.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!