Use print to save an image with high resolution
clc,clear
opengl software
x = 0:1:10;
y = sin(x);
h = plot(x(1),y(1),'or');
line(x,y)
mkdir('test') % create folder
obj = VideoWriter('test/test.avi'); % create video file
obj.FrameRate = 5; % set speed of movie
open(obj) % open object
for i = 1:length(x)
set(h,'xdata',x(i),'ydata',y(i))% move marker
fname = sprintf('test/image%d.png',i); % file name
print(fname,'-djpeg','-r200') % save image with high resolution
I = imread(fname); % read high resolution image
writeVideo(obj,I); % write image to movie file
pause(.2)
end
close(obj);
