声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2141|回复: 4

[GUI界面] 如何返回文本框中符号表达式的内容?

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

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

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

x
如题,不知道这样的说法对不对,或者说如何把输入文本框中的字符串转换成符号表达式?

[ 本帖最后由 eight 于 2007-1-30 21:03 编辑 ]
回复
分享到:

使用道具 举报

发表于 2006-3-31 20:17 | 显示全部楼层
sym(A)
[此贴子已经被作者于2006-3-31 20:17:47编辑过]

 楼主| 发表于 2006-3-31 21:33 | 显示全部楼层
好象不行啊,这样。
  1. close all
  2. figure('position',[100,100,800,500])
  3. H1=uicontrol(gcf,'style','edit',...
  4. 'unit','normalized','position',[0.03,0.03,0.45,0.8],...
  5. 'BackgroundColor',[0.7 0.8 0.9],'ForegroundColor','b',...
  6. 'string','show matrix','fontsize',14);
  7. H2=uicontrol(gcf,'style','edit',...
  8. 'unit','normalized','position',[0.53,0.03,0.45,0.8],...
  9. 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
  10. 'string','input matrix','fontsize',12,'callback',...
  11. ['aa=get(H2,''string'');','set(H1,''string'',aa);']);
  12. set(H2,'Max',100)
  13. H3=uicontrol(gcf,'style','push',...
  14. 'unit','normalized','position',[0.53,0.85,0.12,0.08],...
  15. 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
  16. 'string','求解','fontsize',12,'callback',...
  17. ['bb=sym(''aa'');','cc=solve(''bb'');','set(H1,''string'',cc);']);
复制代码

这个我输入方程,得不出解
发表于 2006-4-2 08:13 | 显示全部楼层
  1. close all
  2. figure('position',[100,100,800,500])
  3. cc='result of matrix +1';
  4. H1=uicontrol(gcf,'style','text',...
  5. 'unit','normalized','position',[0.03,0.03,0.45,0.8],...
  6. 'BackgroundColor',[0.7 0.8 0.9],'ForegroundColor','b',...
  7. 'string','show matrix','fontsize',14);
  8. H2=uicontrol(gcf,'style','edit',...
  9. 'unit','normalized','position',[0.53,0.03,0.45,0.8],...
  10. 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
  11. 'string','input matrix','fontsize',12,'callback',...
  12. ['aa=get(H2,''string'');','set(H1,''string'',aa);']);
  13. set(H2,'Max',100)
  14. H3=uicontrol(gcf,'style','push',...
  15. 'unit','normalized','position',[0.53,0.85,0.12,0.08],...
  16. 'BackgroundColor',[0.9 0.8 0.7],'ForegroundColor','b',...
  17. 'string','matrix + 1','fontsize',12,'callback',...
  18. ['bb=solve(sym(aa));','set(H1,''string'',{aa;cc;char(bb)});']);
复制代码
发表于 2006-4-2 08:38 | 显示全部楼层
我试了,可以用
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-21 13:05 , Processed in 0.086997 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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