MATLAB: I can’t get to diplay values in a edit box. HELP!!!

guimatlab gui

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)

Best Answer

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))