[求助]HAPPY教授,还要麻烦你帮帮我
<P>我是学C的,所以我的程序可能有时候潜意识按照C的规则来写,还要指正了。我下面的程序要做的是,实现A矩阵通过图形界面进行输入,我是想通过一个子函数调用来画出输入矩阵的框图,可是总也画不出来。我想问的问题如下:<BR>1。我想通过用户自己输入阶次来画出矩阵,我是保存在Z里面,不知道后面子函数调用的时候,Z是不是里面有了输入的数据?我这些写程序合适?<BR>2。有没有合适的函数,不用挨个画每个矩阵元素的输入框,只要告诉阶次就可以开辟面积输入?如果没有的话,我这样做,咋总是不能实现我的画矩阵元素输入框功能呢?<BR>3。子函数括号里面需要标出所有用到的变量吗?<BR><BR>我在很努力的看书,但还是解决不了,请您帮看看啊。如果您比较忙,给我指出问题,我自己调试也可以。麻烦了。<BR><BR>clf reset</P><P>H=axes('units','normalized','position', ,'visible','off');<BR>set(gcf,'currentaxes',H);<BR>str='\fontname{隶书}极点配置和状态观测器辅助设计工具';<BR>text(0.250,0.93,str,'fontsize',25);<BR>h_fig=get(H,'parent');<BR>set(h_fig,'units','normalized','position',);</P>
<P><BR>h_text=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR>'string',{'输入阶次:'});</P>
<P>h_edit1=uicontrol(h_fig,'style','edit',...<BR> 'unit','normalized','position',,...<BR>'callback',['z=str2num(get(gcbo,"string"));']);</P>
<P><BR>h_push1=uicontrol(h_fig,'style','push',...<BR> 'unit','normalized','position',,...<BR>'string','确定','callback','creatmatrix(z)');</P>
<P><BR>h_a=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR> 'string',{'A:'});</P>
<P>h_b=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR>'string',{'B:'});</P>
<P>h_c=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR>'string',{'C:'});</P>
<P>h_d=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR> 'string',{'D:'});</P>
<P><BR>h_pole1=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR> 'string',{'输入反馈系统的期望极点:'});</P>
<P>h_pole2=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR>'string',{'输入状态观测器期望极点:'});</P>
<P>h_k=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR>'string',{'K:'});</P>
<P>h_Ke=uicontrol(h_fig,'style','text',...<BR> 'unit','normalized','position',,...<BR> 'string',{'Ke:'});</P>
<P>function creatmatrix(z)<BR>for i=1:z<BR>for j=1:z<BR>uicontrol(h_fig,'style','edit',...<BR> 'position',,...<BR>'callback',['a(i)(j)=str2num(get(gcbo,"string"));']);<BR>end<BR>end </P>
页:
[1]