matlab进度条
2016-03-30 19:12
225 查看
<strong><span style="font-size:24px;">这是用matlab制作的进度条</span></strong>
</pre><pre name="code" class="plain">function h=mywaitbar(varargin) %这是窗口内嵌的进度条 % if nargin ==0 % %直接调用函数,默认创建 hWaitbar=waitbar(0,'嵌入式进度条','visible','off'); hAxes=findall(hWaitbar,'type','axes'); h_axes=copyobj(hAxes,gcf); set(h_axes,'Units','pixels'); pos =get(h_axes,'position'); set(h_axes,'position',[10,10,pos(3:4)]); else if nargin>1 x=varargin{1}; whichbar=varargin{2}; if(nargin==5)&&(ischar(whichbar)||iscell(whichbar)) hWaitbar=waitbar(x,whichbar,'visible','off'); hAxes=findall(hWaitbar,'type','axes'); h_axes=copyobj(hAxes,varargin{3}); set(h_axes,'Units','pixels'); pos =get(h_axes,'position'); set(h_axes,'position',[varargin{3},varargin{3},pos(3:4)]); else if isnumeric(whichbar) h_axes=whichbar; hPatch=findobj(h_axes,'Type','patch'); set(hPatch,'XData',[0 100*x 100*x 0]); if nargin==3 hTitle=get(h_axes,'title'); set(hTitle,'string',varargin{3}); end else error('input arguments error...'); end end end end if nargout==1 h=h_axes; end
</pre><pre name="code" class="plain">
</pre><pre name="code" class="plain">
</pre><pre name="code" class="plain">
</pre><p>之后在命令行中输入:</p><p><pre name="code" class="html"> gca; h=waitbar(0,'开始绘图...','WindowStyle','modal'); t=0:0.01:pi; for i=1:10 plot(t,sin(2*pi*i*t)); waitbar(i/10,h,['已完成' num2str(10*i) '%']); pause(1); end close(h);
结果如下:
相关文章推荐
- ubuntu下安装matlab步骤
- ubuntu下安装matlab
- 【学习笔记】matlab中 pushbutton的buttondownfcn和callback函数有什么区别?
- Matlab绘图-很详细,很全面
- fastica matlab 转载
- 如何设置Matlab的默认属性?
- 将C/C++程序的变量数据导入到MATLAB中的方法!
- 七中滤波方法测试matlab实现
- matlab 3D绘图详解
- Matlab中数据的存储方式
- Matlab中数据的存储方式
- matlab2015a xcode7 找不到sdk问题
- 最大间隔多超平面分类器(多线性SVM分类器)介绍及Matlab实现
- matlab集合经验模态分解EEMD工具包
- 模糊聚类FCM的MATLAB实现
- VS 调用 Matlab (混合编程)
- 傅立叶变换-MATLAB
- matlab 查看电脑系统性能(CPU,GPU),并开启并行运算
- Matlab调用C语言编写MEX文件
- matlab学习笔记