so, browse through google on problem of how create .gif animation series of .fig files, stumble through 1 uses .sdf file, tried rewrite program work .fig files
clear all; close all; dynam = 156; gif_fps = 24; video_filename = 'a.gif'; fh = figure(1); = 1:dynam f_data = getdata(['f' num2str(i,'_%03i', '.fig'); imagesc(f_data); drawnow; frame = getframe(fh); im = frame2im(frame); [imind,cm] = rgb2ind(im,256); if == 0; imwrite(imind,cm,video_filename,'gif', 'loopcount',inf); else imwrite(imind,cm,video_filename,'gif','writemode','append','delaytime',1/gif_fps); end end
so pops error saying
??? frame = getframe(fh); | error: expression left of equals sign not valid target assignment.
which don't understand why happening, , notice matlab not drawing figs, figure pop blank.
the error comes typo. line
f_data = getdata(['f' num2str(i,'_%03i', '.fig'); %bracket missing @ end
should read
f_data = getdata(['f' num2str(i,'_%03i', '.fig']);
without bracket, matlab sees
['f' num2str(i,'_%03i', '.fig'); imagesc(f_data); drawnow; frame
as single string of letters. code's logic therefore a = b = c
, matlab can't interpret this.
to prevent such errors, matlab , editor have nice coloring schemes highlight in dark red text following opening string '
, , turn full string in purple when closing '
used. if see red characters spanning on several lines, that's sign of potential problem. unfortunately, brackets don't have such behavior...
additionnaly, opening figures per se? see if each figure renders (no blank) , able capture frame.
for = 1:dynam %open, frame , close figure fh_tmp = open(['f' num2str(i,'_%03i', '.fig']) frame = getframe(fh_tmp); close(fh_tmp); im = frame2im(frame); ...
i still struggle find getdata
coming from.