Saving images in .FIG format from a source code

조회 수: 1(최근 30일)
Alberto Acri
Alberto Acri 2022년 10월 29일
댓글: Alberto Acri 2022년 10월 30일
Hello everyone!
I have a code that shows me figures with the imshow(outpict) command where "outpict" is shown in the following image (along with other parameters):
I would like to save all the figures shown with imshow(outpict) in the .FIG format in a folder other than the working folder.
In the above image10 images have been opened (parameter k) and each is shown with imshow(outpict).
I thank you if you can help me out.
  댓글 수: 2
Alberto Acri
Alberto Acri 2022년 10월 30일
Thank you @DGM! That's just what I needed!

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

답변(2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 10월 29일
편집: KALYAN ACHARJYA 2022년 10월 29일
for loop i=
figure,imshow(Image_file)
file_name=['image',num2str(i),'.fig']
savefig(gcf,file_name); % Set an other folder path/directory
close all
end
#To set the folder path, yoo can refer your earlier question.
Hope it Helps!

Walter Roberson
Walter Roberson 2022년 10월 29일
Use fullfile(FolderToSaveInto, FileNameToSaveTo) in order to construct the output file name. For example,
savedir = '../saved_results';
file_name = fullfile( savedir, sprintf('myoutput_%04d.fig',k) );
savefig(gcf, file_name)

범주

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by