save matrix to a file with filename specified by a string variable -- how to?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, all:
I'm trying to save a bunch of matrix into a .mat file. 1) If I do save 'record.mat' mat_1 mat_2 mat_3 then, everything goes fine.
2) However, if I do fileName={'record.mat'} save {fileName} mat_1 mat_2 mat_3 then, nothing can be saved.
Since my program should run in recursively, so a bunch of files with different names should be produced. Therefore, I should be able to save file according to my own fileName specification. How to make 2) work?
0 commentaires
Réponses (1)
Jan
le 15 Août 2011
fileName = 'record.mat';
save(fileName, 'mat_1', 'mat_2', 'mat_3');
0 commentaires
Voir également
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!