필터 지우기
필터 지우기

Change a bunch of files name

조회 수: 1 (최근 30일)
Mike Nguyen
Mike Nguyen 2018년 1월 10일
댓글: Mike Nguyen 2018년 1월 10일
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

채택된 답변

Walter Roberson
Walter Roberson 2018년 1월 10일
Before
fil={f.name};
do
f([f.isdir]) = [];
  댓글 수: 1
Mike Nguyen
Mike Nguyen 2018년 1월 10일
Thnks , it is working now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by