% function initFigureFrame
resultFigureName = 'result.gif';
scrsz = get(0,'ScreenSize');
fig = figure;%('Position',[10 10 floor(scrsz(3)*.9)-10 floor(scrsz(4)*.9)-10]);
set(fig,'NextPlot','replacechildren');
ff = getframe(gcf);
ff = frame2im(ff);
[X, map] = rgb2ind(ff, 128);
imwrite(X, map, resultFigureName, 'GIF', 'WriteMode', 'overwrite', 'DelayTime', 0);
