필터 지우기
필터 지우기

How can read a particular file pattern and store it in the same pattern?

조회 수: 2 (최근 30일)
Zara Khan
Zara Khan 2019년 5월 14일
댓글: darova 2019년 5월 17일
My folder consists of 1000 images. File names are of pattern P1_G1_1,P1_G1_2,.................P1_G1_10
P1_G2_1.....................................P1_G2_10
.
.
.
P10_G10_1.....................................P10_G10_10
After the rotation I want to store them in a different folder using the same name pattern . How to do this ?

채택된 답변

darova
darova 2019년 5월 14일
I'd use loops (not tested)
path = 'd:\Studying\matlab\'; % read from
dest = 'd:\Studying\SolidWorks\'; % save to
for i = 1:10
for j = 1:10
for k = 1:10
f = sprintf('P%i_G%i_%i.png',i,j,k); % file name with ".png" extension
A = imread([path, f]); % read image
B = imrotate(A,10); % roate image by 10 degree
imwrite(B,[dest, f]); % save rotated image
end
end
end
  댓글 수: 6
Zara Khan
Zara Khan 2019년 5월 17일
darova, thank you . It has worked nicely . I was missing the folder name.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by