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

8 ビュー (過去 30 日間)
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');


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';
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.

その他の回答 (0 件)


Find more on Graphics Object Identification 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