필터 지우기
필터 지우기

save a figure in a predefined folder as variable using print

조회 수: 4 (최근 30일)
Hi, there is a way to save a specific image (like figure 1 in the example below denoted as '-f1') in a specific folder a using the command “print” as follows:
print('-f1',filename,'-dpng')
where:
filename='EXAMPLE'
Figure1 is a random plot
What is missing here is the path where to save the png image which can be defined like this:
Saved_folder='D:\Main folder \Subfolder \Folder_test'
I would appreciate any help

채택된 답변

Star Strider
Star Strider 2023년 11월 24일
Using the fullfile function may help. You have to supply the necessary information, however fullfile will build the path.
  댓글 수: 2
Jorge Luis Paredes Estacio
Jorge Luis Paredes Estacio 2023년 11월 24일
filename1=fullfile(Saved_folder,filename);
print('-f1',filename1,'-dpng');
It worked perfectly. Thank you very much :)
Star Strider
Star Strider 2023년 11월 24일
As always, my pleasure!

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by