声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2332|回复: 4

请教:如何在图形用户界面(GUI)中交互输入方程求解?

[复制链接]
发表于 2006-3-28 21:08 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
如题,用可编辑文本框?可回调函数怎么能识别?
回复
分享到:

使用道具 举报

发表于 2006-3-29 07:14 | 显示全部楼层
  1. % 文本框输入矩阵并处理
  2. close all
  3. figure('position',[100,100,800,500])
  4. cc='result of matrix +1';
  5. H1=uicontrol(gcf,'style','text',...
  6. 'unit','normalized','position',[0.03,0.03,0.45,0.8],...
  7. 'BackgroundColor',[0.7 0.8 0.9],'ForegroundColor','b',...
  8. 'string','show matrix','fontsize',14);
  9. H2=uicontrol(gcf,'style','edit',...
  10. 'unit','normalized','position',[0.53,0.03,0.45,0.8],...
  11. 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
  12. 'string','input matrix','fontsize',12,'callback',...
  13. ['aa=get(H2,''string'');','set(H1,''string'',aa);']);
  14. set(H2,'Max',100)
  15. H3=uicontrol(gcf,'style','push',...
  16. 'unit','normalized','position',[0.53,0.85,0.12,0.08],...
  17. 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
  18. 'string','matrix + 1','fontsize',12,'callback',...
  19. ['bb=str2num(aa)+1;','set(H1,''string'',{aa;cc;num2str(bb)});']);
复制代码
 楼主| 发表于 2006-3-29 09:02 | 显示全部楼层
谢谢suffer,可是这个代码好象只可以识别数字,对字符却视而不见啊。这样的话还是不能输入方程啊
 楼主| 发表于 2006-3-29 21:36 | 显示全部楼层
高手帮忙看一下撒
发表于 2006-5-11 14:59 | 显示全部楼层
加条字符转换语句
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-24 03:07 , Processed in 0.058963 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表