Hi I am trying to change all the file names in a folder I have of .tif images. I want to use the number of tif images in the file to be apart of the new save name.
INDIV = 'folder_path'; %
filenames_INDIV = dir(fullfile(INDIV, '*.tif')); % <-- 126x1 struct
original_images_indv = numel(filenames_INDIV); % <-- 126
for g = 1 : filenames_INDIV for h = 1 : original_images_indv [~, f] = fileparts(filenames_INDIV(h).name); % write the rename file
rf = strcat(f,'SAM%03d', h) ; % rename the file
movefile(filenames_INDIV(h).name, rf); endend
But I end up getting
Undefined function 'colon' for input arguments of type 'struct' for the first for statement
Best Answer