Clear Filters
Clear Filters

How to automatcly save a plot in matlab

1 view (last 30 days)
I have a loop that do plotting. Is there a way instead of manually saving the graph the plots automatically be saved?

Accepted Answer

Grzegorz Knor
Grzegorz Knor on 3 Dec 2011
Simple example:
x = linspace(0,1,100);
for k=1:10
stem(x,x/k)
ylim([0 1])
filename = sprintf('pic%i',k);
print('-djpeg', filename, '-r100');
end

More Answers (0)

Categories

Find more on Line Plots 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!