필터 지우기
필터 지우기

How to save a figure file into a subfolder

조회 수: 408 (최근 30일)
James hall
James hall 2012년 8월 17일
댓글: tchaddad 2020년 11월 9일
Hi guys,
I want to save my .fig files in a subfolder of the current working folder. how would I accomplish this using this saveas syntax
*************************************************
saveas(figure(i), fullfile('Figure name'), 'fig');
*************************************************
Many Thanks in advance

채택된 답변

José-Luis
José-Luis 2012년 8월 17일
Here goes:
saveas(figure(1),[pwd '/subFolderName/myFig.fig']);
Cheers!
  댓글 수: 3
John Hunt
John Hunt 2019년 3월 13일
What does the pwd do?
Image Analyst
Image Analyst 2019년 3월 14일
pwd is the current folder. That means subFolderName must be a currently existing folder of whatever folder you're in now.
See my answer below if you want to specify a different folder.

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

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 8월 17일
편집: Image Analyst 2012년 8월 17일
Why not save them as images so that you can see them in any program or in WIndows Explorer? See the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
But in general you'd need to specify the folder:
folder = 'c:\whatever';
baseFileName = sprintf('Figure %d', loopIndex);
fullFileName = fullfile(folder, baseFileName);
It's recommended that you don't use i as a loop index or variable name because that's the imaginary variable sqrt(-1).
  댓글 수: 2
Pooja Mehta
Pooja Mehta 2017년 2월 23일
I want to use this method for Gui and for that i need to add a select folder option in UI. Is there any function for selecting folder?

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

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by