⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shili31.m

📁 matlab的基础应用,主要是基础部芬的学习笔记,大家看看有没有用!
💻 M
字号:
h0=figure('toolbar','none',...
                  'position',[198 56 408 468],...
                  'name','实例32');
              h1=axes('parent',h0,...
                  'position',[0.15 0.45 0.7 0.5],...
                  'visible','on');
              t=0:pi/24:4*pi;
              y=sin(t);
              plot(t,y,'b')
              n=length(t);
              h=line('color',[0 0.5 0.5],...
                  'linestyle','.',...
                  'markersize',25,...
                  'erasemode','xor');
              k1=uicontrol('parent',h0,...
                  'style','pushbutton',...
                  'position',[80 100 50 30],...
                  'string','开始',...
                  'callback',[...
                      'i=1;',...
                      'k=1;,',...
                      'm=0;,',...
                      'while 1,',...
                      'if k==0,',...
                      'break,',...
                      'end,',...
                      'if k~=0,',...
                      'set(h,''xdata'',t(i),''ydata'',y(i)),',...
                      'drawnow;,',...
                      'i=i+1;,',...
                      'if i>n,',...
                      'm=m+1;,',...
                      'i=1;,',...
                      'end,',...
                      'end,',...
                      'end']);
              k2=uicontrol('parent',h0,...
                  'style','pushbutton',...
                  'position',[180 100 50 30],...
                  'string','停止',...
                  'callback',[...
                      'k=0;,',...
                      'set(e1,''string'',m),',...
                      'p=get(h,''xdata'');,',...
                      'q=get(h,''ydata'');,',...        
                      'set(e2,''string'',p);,',...
                      'set(e3,''string'',q)']);
              k3=uicontrol('parent',h0,...
                  'style','pushbutton',...
                  'position',[280 100 50 30],...
                  'string','关闭',...
                  'callback','close');
              e1=uicontrol('parent',h0,...
                  'style','edit',...
                  'position',[60 30 60 20]);
              t1=uicontrol('parent',h0,...
                  'style','text',...
                  'string','循环次数',...
                  'position',[60 50 60 20]);
              e2=uicontrol('parent',h0,...
                  'style','edit',...
                  'position',[180 30 50 20]);
              t2=uicontrol('parent',h0,...
                  'style','text',...
                  'string','终点的X坐标值',...
                  'position',[155 50 100 20]);
              e3=uicontrol('parent',h0,...
                  'style','edit',...
                  'position',[300 30 50 20]);
              t3=uicontrol('parent',h0,...
                  'style','text',...
                  'string','终点的Y坐标值',...
                  'position',[275 50 100 20]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -