OUtput names same as input names?

조회 수: 1 (최근 30일)
reyadh Albarakat
reyadh Albarakat 2018년 2월 7일
댓글: Jan 2018년 2월 7일
Hi Everybody,
I have 150 images as you know each image has name. the output will be 150 image. how to use for loop to save output image with same name of inputs.
Thanks for your help
Reyadh
  댓글 수: 1
Rik
Rik 2018년 2월 7일
Just use the same names when writing out your resulting images. What is your question?
Have a read here and here. It will greatly improve your chances of getting an answer.

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

채택된 답변

Jan
Jan 2018년 2월 7일
As soon as you are able to get the list of input names, it is trivial to use them as output names also. So maybe your question is, how you get the names of the input files? Then see FAQ: Process a sequence of files.
InFolder = 'D:\Your\Folder\';
OutFolder = 'D:\Your\Folder\';
DirList = dir(fullfile(InFolder, '*.jpg'));
for iFile = 1:numel(DirList)
InFile = fullfile(InFolder, DirList(iFile).name);
% Maybe you want to create the output in another folder?
OutFile = fullfile(OuFolder, DirList(iFile).name);
...
end
  댓글 수: 2
reyadh Albarakat
reyadh Albarakat 2018년 2월 7일
Dear Jan, I want to save output images same name of the original images.
suppose I have 2 input images which are (20000326_B3.TIF and 20000521_B3.TIF)So I will get 2 output images I want to save 1st output image with name (20000326_B3.TIF) and the 2nd output image with name (20000521_B3.TIF)
Jan
Jan 2018년 2월 7일
Exactly what my code does. So what is the actual problem?
Do you want to overwrite the input file or use the same name in a different folder?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by