I want to save my figure in another path. Every time I used the command save figure it saved in Desktop how I can change it
조회 수: 22 (최근 30일)
이전 댓글 표시
clc;
clear;
N = [10 20 30 40 50];
M = [1 2 3 4 5];
K=[1 3 5 6 7];
x = linspace(0, 1, 17);
legendString = "N = " + string(N) + ", M = " + string(M);
ph = plot(x,N.*x');
hold on
ph2 = plot(x+2,N.*x');
legend(ph,legendString)
savefig('FA.fig')
채택된 답변
Allen
2021년 5월 26일
If your filename does not indicate the filepath in front of the filename, then MATLAB used your default directory location to save files. You can correct this by adding the desired file path to your filename.
file = 'C:\...\FA.fig';
%or
file = fullfile('C:\...','FA.fig');
If you are wanting more flexibility of where to save your files, you can use the uiputfile function to designate a directory location and filename before saving your file.
% Launches a system save file window.
[fn,pn] = uiputfile("*.fig","Save Figure to Specified Location");
% Performs a quick check to make sure that the save file window was not
% closed with X or Cancel.
if ~isnumeric(fn) % fn will be numeric if no file is selected, else it will be text.
savefig(fullfile(pn,fn))
end
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!