how save plot in specific folder ?

330 views (last 30 days)
Muhannad Saleh
Muhannad Saleh on 10 Mar 2021
Commented: Jan on 11 Mar 2021
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

Accepted Answer

Jan on 10 Mar 2021
Add the wanted path to the file name:
filename = fullfile('D:\Your\Folder', 'File.jpg')
exportgraphics(obj, filename)
Jan on 11 Mar 2021
Folder = 'D:\Your\Folder';
for k = 1:100
filename = sprintf('File%03d.jpg', k);
file = fullfile(Folder, filename);
exportgraphics(obj, file);

Sign in to comment.

More Answers (1)

Ruger28 on 10 Mar 2021
In older versions of MATLAB:
filename = fullfile('D:\Your\Folder', 'File.jpg');
  1 Comment
Muhannad Saleh
Muhannad Saleh on 11 Mar 2021
how can save more pic in loop with difrient name ?

Sign in to comment.


Find more on Migrate GUIDE Apps 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