Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2012-03-26
帖子: 1
声望力: 0 ![]() |
![]()
编了个程序,想实现
1.在地址栏输入文档名称,回车,即可以txt文档第一列为横坐标,第二列为纵坐标,在坐标系中画出曲线 2.点击右边的YMAX按钮,可在编辑栏显示该曲线y轴上的最大值 编来编去都不能实现第二个功能,请高手赐教,小妹谢过! clf reset H=axes('unit','normalized','position',[0,0,1,1],'visible','off'); set(gcf,'currentaxes',H); str='test'; text(0.2,0.95,str,'fontsize',22); h_fig=get(H,'parent'); set(h_fig,'unit','normalized','position',[0.1,0.1,0.5,0.5],'Toolbar','figure'); h_axes=axes('parent',h_fig,... 'unit','normalized','position',[0.1,0.1,0.6,0.6],... 'xlim',[-10 10],'ylim',[-10 10],'fontsize',8); a_edit=uicontrol(h_fig,'style','edit',... 'unit','normalized','position',[0.1,0.83,0.4,0.06],... 'horizontal','left','callback',[... 'k=get(gcbo,''string'');,',... 'A=load(k);,',... 'a=A(:,1);,',... 'b=A(:,2);,',... 'hp=plot(a,b),hold on;,',... 'hold off;']); ym_edit=uicontrol(h_fig,'style','edit','unit','normalized',... 'position',[0.7,0.6,0.3,0.05],'horizontal','left'); ym_push=uicontrol(h_fig,'style','push',... 'unit','normalized',... 'string','YMAX',... 'position',[0.7,0.8,0.3,0.05],... 'horizontal','left',... 'callback',[... 'bmm=max(b);,',... 'bmax=num2str(bmm);,',... 'set(ym_edit,"string",bmax);']); |
![]() |
![]() |