在播放电影之前缩放 movie() 的输出

Scale the output of movie() before playing the movie

我正在尝试在 matlab 中创建一个 movie() 闪烁的棋盘。我正在使用以下代码创建框架:

close all;

n=80; % length of checkerboard squares in pixels
p=5; % number of checkerboard rows
q=6; % number of checkerboard columns
loops=100;

A=zeros(p*n,q*n,2);
my_checkerboard=logical(checkerboard(n,p,q));
A(:,:,1)=double(my_checkerboard(1:p*n,1:q*n));
A(:,:,2)=ones(p*n,q*n);
%A(:,:,2)=double(~my_checkerboard(1:p*n,1:q*n));
F(loops)=struct('cdata',[],'colormap',[]);

h=figure;
for ii=1:1000
    figure(h);
    imshow(A(:,:,mod(ii,2)+1));
    drawnow;
    F(ii)=getframe;
end

现在如果我这样播放电影

close all;
h=figure;
movie(h,F,1,10)

我将能够通过绘制图形的角来缩放电影。但是如果我像这样缩放之前的数字

close all;
h=figure('Position',[2640,280,960,800]);
movie(h,F,1,10)

电影不会随数字缩放。相反,电影将在图中的左下角播放。
我觉得这不仅可以通过缩放图形还可以通过缩放轴来完成,但我不知道该怎么做。

编辑:我也很高兴,如果有人可以 link 我在 gif 生成器或其他东西上的一些资源,可以轻松创建具有可自定义数量的图块的可缩放闪烁棋盘。

我认为 MATLAB 中存在错误 movie...

以下代码在大多数情况下有效:

close all;

n=80; % length of checkerboard squares in pixels
p=5; % number of checkerboard rows
q=6; % number of checkerboard columns
loops=100;

A=zeros(p*n,q*n,2);
my_checkerboard=logical(checkerboard(n,p,q));
A(:,:,1)=double(my_checkerboard(1:p*n,1:q*n));
A(:,:,2)=ones(p*n,q*n);
%A(:,:,2)=double(~my_checkerboard(1:p*n,1:q*n));
F(loops)=struct('cdata',[],'colormap',[]);

h=figure;
for ii=1:10
    figure(h);
    %imshow(A(:,:,mod(ii,2)+1));
    imshow(A(:,:,mod(ii,2)+1), 'Border', 'tight'); %Show image without borders
    drawnow;
    F(ii)=getframe;
end

savefig(h, 'h.fig') %Save the figure to a file, (not the best solution).

%Playing the movie
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all;
h = openfig('h.fig'); %Load the figure

% h=figure;
movie(h,F,1,10)

保存和加载图形,只是保持原始图形尺寸的一种简单方法。