How could I save a file under different name?
Afficher commentaires plus anciens
if true
files = dir('*.csv');
for f = 1:length(files)
file = files(f);
RawData=importdata(file.name,',',4);
MusAct=RawData.data;
title = file.name;
new_title = strrep(title, file.name, file.name+'HoldPCA');
dlmwrite(new_title, mean3tr,'delimiter',',','-append');
end
end
I have files that I modified and I want to save them under different names. For example, if an original file name is 'filename.csv', I want to save it as 'filename_Mean.csv'. I want to save as a file, and then move to the next file.. How could I do this? Could I do this in a loop?
Réponses (1)
Image Analyst
le 28 Juin 2013
1 vote
Use movefile() to rename a file.
Use copyfile() to copy a file.
See the FAQ for code examples about processing files in a loop: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Catégories
En savoir plus sur Text Data Preparation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!