is it possible to plot and save figure in console mode?

8 views (last 30 days)
using the plot function in -nodisplay mode is possible without error or warning? and the plot can be saved in .pgn format?

Answers (1)

Thorsten
Thorsten on 28 Jun 2015
x = 1:10; y = x;
h = plot(x, y);
% Save plot in png format using hgsave
hgsave(h, 'sample.png');
  2 Comments
Mr M.
Mr M. on 28 Jun 2015
thanks, but I want to display the plot in case of non-command mode. So it would be nice to work well in both cases.
Thorsten
Thorsten on 29 Jun 2015
Edited: Thorsten on 29 Jun 2015
Add before the plot:
try
figure
catch
% do nothing
end

Sign in to comment.

Categories

Find more on Graphics Performance 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!