I can't get to diplay values in a edit box. HELP!!!

2 次查看(过去 30 天)
Here is the full code
syms t n;
T=4
w0=2*pi/T
n=1:15
a0=(1/T)*int(1,t,0,2)
an=(2/T)*int(1*cos(n*w0*t),t,0,2)
bn=(2/T)*int(1*sin(n*w0*t),t,0,2)
set(handles.a0,'string',a0)
set(handles.an,'string',an)
set(handles.bn,'string',bn)
I want to diplay the values of a0, an and bn in edit boxes but for some reason it is giving error in these lines
set(handles.a0,'string',a0)
set(handles.an,'string',an)
set(handles.bn,'string',bn)

采纳的回答

Rik
Rik 2020-4-2
It looks like you are trying to set a numeric value as the String property. You will first have to convert your symbolic values to char.
syms t n;
T=4;
w0=2*pi/T;
n=1:15;
a0=(1/T)*int(1,t,0,2);
an=(2/T)*int(1*cos(n*w0*t),t,0,2);
bn=(2/T)*int(1*sin(n*w0*t),t,0,2);
set(handles.a0,'string',char(a0))
set(handles.an,'string',char(an))
set(handles.bn,'string',char(bn))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by