How to Save Multiple MATLAB plots as Fig files?

2 views (last 30 days)
BM
BM on 14 Jan 2019
With MATLAB 2018b, one can now hover over a gridpoint with the cursor to obtain a location. This ability is only present when the plot is open in a Fig file. Mutiple values of a particular parameter are computed in each run, with each value's collection of plots saved as jpg or pdf files. Once this feature came in MATLAB 2018b, I wanted to switch to saving my files as Fig files, but the techniques I tried on the MATLAB Answers site have given me issues. I either could not save the series of fig files produced as fig files, or else I could not keep the dynamic name feature. The code for the save to JPG is posted below (Note: the filename is dynamic). I want to keep everything the same, but save fig files.
filename = strcat('Example',num2str(N),'_q_',num2str(q,'%.3f'));
if savejpg
% save as jpg
print(1,'-painters','-djpeg',strcat(filename,'r','.jpg'));
print(2,'-painters','-djpeg',strcat(filename,'b','.jpg'));
end

Answers (0)

Categories

Find more on Graphics Objects in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!