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

2 views (last 30 days)
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)

Accepted Answer

Rik
Rik on 2 Apr 2020
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))

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!