how to rename files .tif in a folder ?
    3 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Ade Aulya
 am 11 Dez. 2018
  
    
    
    
    
    Kommentiert: Stephen23
      
      
 am 11 Dez. 2018
            hi.. does anyone can help me with this code, please ? it's created by Jiro Doke. it were run but i didn't get the name file as i want. i wanted to change those file's number into only 1,2,3,4,5,and so on..  FYI,  i've tried to change the folder name like this..
% Get all files in the current folder clear all;
files = dir(fullfile('C:\Users\ASUS\Desktop\2','*.tif'));
% Loop through each
for id = 1:length(files)
 % Get the file name (minus the extension)
[~, f] = fileparts(files(id).name);
% Convert to number
num = str2double(f);
if ~isnan(num)
 % If numeric, rename
APath = fullfile('C:\Users\ASUS\Desktop\2', files(id).name);
movefile(APath, sprintf('%d.tif', num));
end
end
and the output files name were like this :
    2.100000e+00.tif
    2.100100e+00.tif
    2.100200e+00.tif
    2.100300e+00.tif
    2.100400e+00.tif
    2.100500e+00.tif
    etc..
  or if i want to change it like 
     1a
     2a
     3a
   continue directly to 
     5b
     6b
     7b
    and so on..
what should i do, please ?
thank you so much. 
3 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Convert Image Type finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!