MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB GUI] 新手求助啦,请各位帮我看看这个程序 (https://www.labfans.com/bbs/showthread.php?t=14571)

ppkeiko 2012-04-05 15:46

新手求助啦,请各位帮我看看这个程序
 
编了个程序,想实现
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);']);


所有时间均为北京时间。现在的时间是 06:23

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.