How to save a figure in a different directory and with a dynamic name using export_fig?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello! I am using export_fig to save the plots I am producing with matlab. What I want to do is:
- Save the figures in a different directory than the one I am working.
- Give a dynamic name to the saved figure according to the file that the program is reading every time.
- Use the command -transparent to remove the grey area around the figure.
My code is this:
baseFileName = sprintf('mass_conc_%s',sprintf('%s',char(cellstr(date.date(1)))));
saveas(gcf,baseFileName,'pdf')
export_fig baseFileName -transparent
This code is not saving the .png file (produced with export_fig) with the same name as the pdf file and I cannot specify another directory for saving it.
Thank you in advance for your help! Dimitra
댓글 수: 0
답변 (1개)
Thorsten
2016년 7월 19일
Some hints, since it appears to be homework:
help fileparts % separate path, name and extension
help fullfile % to generate a new full filename
Use the functional syntax of print and export_fig, i.e., use parentheses (...)
export_fig(newfilename, 'transparent') % not sure if this is the right syntax
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Adding custom doc에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!