怎么给Matlab GUI界面设置刷新
2个回答
展开全部
function test()
clear;
clc;
K = 1; %K 红球运动的循环数
%%
t1=(0:1000)/1000*10*pi;
x1=cos(t1);y1=sin(t1);z1=-t1;
t2=(0:10)/10;
x2=x1(end)*(1-t2);y2=y1(end)*(1-t2);z2=z1(end)*ones(size(x2));
t3=t2;
z3=(1-t3)*z1(end);x3=zeros(size(z3));y3=x3;
t4=t2;
x4=t4;y4=zeros(size(x4));z4=y4;
x=[x1 x2 x3 x4];y=[y1 y2 y3 y4];z=[z1 z2 z3 z4];
h=figure('numbertitle','off','name','Moving Ball——Matlabsky');
plot3(x,y,z,'b');
axis off
%%
%Draw the red circle
h=line('Color',[1 0 0],'Marker','.','MarkerSize',40,'EraseMode','none'); %Erease mode is :xor
n=length(x);
i=1;j=1;
%changing the axis,
while 1
if ~ishandle(h),return,end
set(h,'xdata',x(i),'ydata',y(i),'zdata',z(i));
drawnow;
pause(0.0001) %pause, could change the move speed of the ball
i=i+1;
if i>n
%判断是否运行了一周,是将i设置为1,并将运行周数j加1
i=1;j=j+1;
%判断是否到指定的运行周数,是,退出
if j>K;break;end
end
end
clear;
clc;
K = 1; %K 红球运动的循环数
%%
t1=(0:1000)/1000*10*pi;
x1=cos(t1);y1=sin(t1);z1=-t1;
t2=(0:10)/10;
x2=x1(end)*(1-t2);y2=y1(end)*(1-t2);z2=z1(end)*ones(size(x2));
t3=t2;
z3=(1-t3)*z1(end);x3=zeros(size(z3));y3=x3;
t4=t2;
x4=t4;y4=zeros(size(x4));z4=y4;
x=[x1 x2 x3 x4];y=[y1 y2 y3 y4];z=[z1 z2 z3 z4];
h=figure('numbertitle','off','name','Moving Ball——Matlabsky');
plot3(x,y,z,'b');
axis off
%%
%Draw the red circle
h=line('Color',[1 0 0],'Marker','.','MarkerSize',40,'EraseMode','none'); %Erease mode is :xor
n=length(x);
i=1;j=1;
%changing the axis,
while 1
if ~ishandle(h),return,end
set(h,'xdata',x(i),'ydata',y(i),'zdata',z(i));
drawnow;
pause(0.0001) %pause, could change the move speed of the ball
i=i+1;
if i>n
%判断是否运行了一周,是将i设置为1,并将运行周数j加1
i=1;j=j+1;
%判断是否到指定的运行周数,是,退出
if j>K;break;end
end
end
2016-05-26
展开全部
实现clear,清除所有数据和图像显示
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询