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

19 visualizaciones (últimos 30 días)
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')

Respuesta aceptada

Allen
Allen el 26 de Mayo de 2021
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

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by