找回密码
 注册
Simdroid-非首页
查看: 82|回复: 2

求助!Figure destroyed during getframe

[复制链接]
发表于 2010-6-18 18:19:44 | 显示全部楼层 |阅读模式 来自 北京
本人初学matlab。下面是一段程序。
clear
hf=figure;
t=0:pi/1000:2*pi;
x=2*sin(t);
y=2*cos(t);
h=plot(x,y);
set(h,'LineWidth',3)
axis([-3 3 -3 3]);
title('Clock');
hold on
for j=1:12
    if rem(j-1,12)==0
        hm1=text(1.8*cos(-(j-1)*pi/30+pi/2),1.8*sin(-(j-1)*pi/30+pi/2),'12');
        set(hm1,'FontSize',18);
    else
        hm2=text(1.8*cos(-(j-1)*pi/6+pi/2),1.8*sin(-(j-1)*pi/6+pi/2),int2str(rem(j-1,12)));
        set(hm2,'FontSize',18);
    end
end
x1=[0 0];x2=[1.7 2];x3=[0 0];x4=[-1.7 -2];
y1=[1.7 2];y2=[0 0];y3=[-1.7 -2];y4=[0 0];
h11=line(x1,y1,'LineWidth',2,'Color','r');
h12=line(x2,y2,'LineWidth',2,'Color','r');
h13=line(x3,y3,'LineWidth',2,'Color','r');
h14=line(x4,y4,'LineWidth',2,'Color','r');
while ishandle(hf)
    for j=1:60
    for i=1:60
        x1=[0 1.9*cos(-(i-1)*pi/30+pi/2)];
        y1=[0 1.9*sin(-(i-1)*pi/30+pi/2)];
        x2=[0 1.5*cos(-(j-1)*pi/30+pi/2)];
        y2=[0 1.5*sin(-(j-1)*pi/30+pi/2)];
        h1=line(x1,y1);set(h1,'LineWidth',0.5,'Color','r');
        h2=line(x2,y2);set(h2,'LineWidth',2,'Color','g');
        hm=text(0.5,0,int2str(j-1));
        text(0.7,0,':');
        hs=text(0.8,0,int2str(i-1));
        F=getframe();
        delete(h1);
        delete(h2);
        delete(hm);
        delete(hs);
    end
end
end
movie(F)
运行后,命令窗口出现了下面的东西:
??? Error using ==> capturescreen
Figure destroyed during getframe
Error in ==> getframe at 35
  x=capturescreen(varargin{:});
Error in ==> Clock at 38
        F=getframe();
求高人指点,谢谢
发表于 2010-6-20 00:59:21 | 显示全部楼层 来自 黑龙江哈尔滨
Simdroid开发平台
getframe应该紧跟在绘图命令后面,仔细看看help中的getframe的例子
回复 不支持

使用道具 举报

 楼主| 发表于 2010-6-23 20:48:02 | 显示全部楼层 来自 北京
貌似已经了解了。我是在该程序还没运行完的时候,就关闭了图形窗口,结果就出现这个问题。
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Simapps系列直播

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-9-30 11:22 , Processed in 0.043419 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表