how save plot in specific folder ?

109 次查看(过去 30 天)
i uesd ( spectrogram ) to plot pic i need save this pic in specific folder i created i use ( exportgraphics ) but is save in current folder how can save with any folder whant

采纳的回答

Jan
Jan 2021-3-10
Add the wanted path to the file name:
filename = fullfile('D:\Your\Folder', 'File.jpg')
exportgraphics(obj, filename)
  3 个评论
Muhannad Saleh
Muhannad Saleh 2021-3-11
how can save more pic in loop with difrient name ?
Jan
Jan 2021-3-11
Folder = 'D:\Your\Folder';
for k = 1:100
filename = sprintf('File%03d.jpg', k);
file = fullfile(Folder, filename);
exportgraphics(obj, file);
end

请先登录,再进行评论。

更多回答(1 个)

Ruger28
Ruger28 2021-3-10
In older versions of MATLAB:
filename = fullfile('D:\Your\Folder', 'File.jpg');
saveas(MyFigure,filename);

类别

Help CenterFile Exchange 中查找有关 Printing and Saving 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by