发一个我以前在仿真论坛的代码,作个参考(用getframe);当然你的问题更简单.
%%%============================%%%
以前曾调用过数字地球图形,最简单的几行代码如下:
%%%%%%%%%%%%%%%%
load topo
imagesc(flipud(topo))
%%%%%%%%%%%%%%%%
%%%或者
load topo
topo1 = topo;
topo1(topo<0) = 0;
topo1 = 100*topo1/(almanac('earth','radius')*1000);
axesm globe;
view([180 38]);
axis off;
meshm(topo,topolegend,size(topo),topo1);
demcmap(topo)
shading interp
lightm(23.5,71,'Color','y')
material([.5 .7 1.5]);
lighting phong
camzoom(2);
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%再加几行代码,做成动画
for i=1:30
camorbit(360/30,0);
M(:,i)=getframe(gcf);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%
另外,作循环,用drawnow亦可,一个简单例子:
%%%========================%%%
clear all
for a=1:10
x=-pi:pi/50:pi;
plot(x,cos(a*x))
drawnow
pause(1)
end
[ 本帖最后由 xjzuo 于 2007-12-6 17:40 编辑 ] |