浪尖 发表于 2006-3-31 10:35

如何返回文本框中符号表达式的内容?

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

[ 本帖最后由 eight 于 2007-1-30 21:03 编辑 ]

happy 发表于 2006-3-31 20:17

sym(A)
[此贴子已经被作者于2006-3-31 20:17:47编辑过]

浪尖 发表于 2006-3-31 21:33

好象不行啊,这样。
close all
figure('position',)
H1=uicontrol(gcf,'style','edit',...
'unit','normalized','position',,...
'BackgroundColor',,'ForegroundColor','b',...
'string','show matrix','fontsize',14);
H2=uicontrol(gcf,'style','edit',...
'unit','normalized','position',,...
'BackgroundColor',,'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',,...
'BackgroundColor',,'ForegroundColor','b',...
'string','求解','fontsize',12,'callback',...
['bb=sym(''aa'');','cc=solve(''bb'');','set(H1,''string'',cc);']);
这个我输入方程,得不出解

happy 发表于 2006-4-2 08:13

close all
figure('position',)
cc='result of matrix +1';
H1=uicontrol(gcf,'style','text',...
'unit','normalized','position',,...
'BackgroundColor',,'ForegroundColor','b',...
'string','show matrix','fontsize',14);
H2=uicontrol(gcf,'style','edit',...
'unit','normalized','position',,...
'BackgroundColor',,'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',,...
'BackgroundColor',,'ForegroundColor','b',...
'string','matrix + 1','fontsize',12,'callback',...
['bb=solve(sym(aa));','set(H1,''string'',{aa;cc;char(bb)});']);

assist 发表于 2006-4-2 08:38

我试了,可以用
页: [1]
查看完整版本: 如何返回文本框中符号表达式的内容?