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

조회 수: 1 (최근 30일)
Saad Rana
Saad Rana 2020년 4월 2일
답변: Rik 2020년 4월 2일
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