Effacer les filtres
Effacer les filtres

Change a bunch of files name

1 vue (au cours des 30 derniers jours)
Mike Nguyen
Mike Nguyen le 10 Jan 2018
Commenté : Mike Nguyen le 10 Jan 2018
I have a set of images in image folder located at C:\temp\image. The images are from yale faces, and I want to add extension .jpg to file name(like that subject01.glasses.jpg, subject01.happy.jpg). The original names are like that subject01.glasses, subject01.happy.
I got the error message "Cannot open file "." for reading. You might not have read permission. "
clc;clear all;close all;
f=dir('*');
fil={f.name};
for k=1:numel(fil)
file=fil{k};
new_file = sprintf('%sjpg',file);;
% % new_file=strrep(file,'.jpg','.png')
im=imread(file);
imwrite(im,new_file);
end

Réponse acceptée

Walter Roberson
Walter Roberson le 10 Jan 2018
Before
fil={f.name};
do
f([f.isdir]) = [];
  1 commentaire
Mike Nguyen
Mike Nguyen le 10 Jan 2018
Thnks , it is working now

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Segmentation and Analysis 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!

Translated by