how to use sprintf with fullfile
Mostra commenti meno recenti
I have the following code:
myFolder = 'D:\data';
myFiles = fullfile(myFolder,'*.txt');
allFiles = dir(myFiles);
for i = 1 : length(allFiles)
baseFilename = allFiles(i).name;
Filename = fullfile(myFolder,baseFilename,sprintf('%d%02d.txt',i));
fid = fopen(Filename);
A{i} = fscanf(fid, '%d %d %d');
fclose(fid);
end
I got an error 'invalid file identifier'. My Filename is incorrect. How should i write sprintf together with fullfile. My file names written as 0101,0102,...,6001,6002.txt.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Filename Construction in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!