- % 文本框输入矩阵并处理
- close all
- figure('position',[100,100,800,500])
- cc='result of matrix +1';
- H1=uicontrol(gcf,'style','text',...
- 'unit','normalized','position',[0.03,0.03,0.45,0.8],...
- 'BackgroundColor',[0.7 0.8 0.9],'ForegroundColor','b',...
- 'string','show matrix','fontsize',14);
- H2=uicontrol(gcf,'style','edit',...
- 'unit','normalized','position',[0.53,0.03,0.45,0.8],...
- 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
- 'string','input matrix','fontsize',12,'callback',...
- ['aa=get(H2,''string'');','set(H1,''string'',aa);']);
- set(H2,'Max',100)
- H3=uicontrol(gcf,'style','push',...
- 'unit','normalized','position',[0.53,0.85,0.12,0.08],...
- 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
- 'string','matrix + 1','fontsize',12,'callback',...
- ['bb=str2num(aa)+1;','set(H1,''string'',{aa;cc;num2str(bb)});']);
复制代码 |