Save the. m gif file and the. m gif file.
Filename = strcat ('C: \ Users \ Public \ Videos \ Sample Videos \ imw \ imwrite \ ', int2str (I ),'. ', 'jpg'); % convert each image into jpg search clear; clc; figure % create a new image axis ([0 5 0 2]) % defines the range of the X axis (from 0 to 5) and Y axis (from 0 to 2) for I = if I = 1 text (I, 1, 'bai ', 'fontsize', 40, 'color', 'red'); % I = 1, write an '100' word end if I = 2 text (I, 1, degree, fontsize, 40, 'color', 'red'); % I = 2, write an 'degree 'word end if I = 3 text (I, 1, 'longitude', 'fontsize', 40, 'color', 'red '); when % I = 3, write an end if I = 4 text (I, 1, 'test ', 'Fontsize', 40, 'color', 'red'); % I = 4, write a 'validate 'word end picname = [num2str (I )'. fig ']; % saved file name: for example, when I = 1, picname = 1.fig hold on % does not overwrite the previous word when writing the following word (gcf, picname) endstepall = 4; for I = 1: stepall picname = [num2str (I )'. fig ']; open (picname) % set (gcf, 'outerposition', get (0, 'screensize'); % matlab window maximization frame = getframe (gcf ); im = frame2im (frame); % create a gif file. The image must be an index image [I, map] = rgb2ind (im, 20); if I = 1 imwrite (I, map, 'baidujing Yan.gif ', 'gif', 'loopcount', inf, 'delaytime', 0.5); % creation required for the first time! Elseif I = stepall else ', 'gif', 'writemode', 'append', 'delaytime', 0.5); else imwrite( I ,map,'baidujingyan.gif', 'gif', 'writemode ', 'append', 'delaytime', 0.5); end; close allend