Function vpa in matlab GUI

조회 수: 2 (최근 30일)
Olaniyi Olufunmilayo
Olaniyi Olufunmilayo 2017년 5월 13일
댓글: Olaniyi Olufunmilayo 2017년 5월 13일
hi guys,i have been trying to get this piece of code to work for a couple of hours now but to no avail. It will be more appreciated if i can get help. This works fine when i try to display on the command window but doesn't work when i do the same on the gui. a sample of the code is shown below;
syms Pw1
Pw=((3*M)+sind(IF))*Pw1+(sind(IF)-M)*(sqrt(((Y-Pw1)^2)+Z)+X)-(4*BC*R*sind(IF))+(4*CH*cosd(IF));
solPw1 = solve(Pw,Pw1);
set(handles.PW_Breakout1,'String',vpa(solPw1));

채택된 답변

John D'Errico
John D'Errico 2017년 5월 13일
Your problem is that vpa does NOT create a string.
vpa(pi,50)
ans =
3.1415926535897932384626433832795028841971693993751
whos ans
Name Size Bytes Class Attributes
ans 1x1 8 sym
As you can see, vpa creates a number, that is still a symbolic value. NOT a string.
What do you need to stuff a gui field? A STRING.
char(vpa(pi,50))
ans =
'3.1415926535897932384626433832795028841971693993751'
What did char do? Take a look.
  댓글 수: 1
Olaniyi Olufunmilayo
Olaniyi Olufunmilayo 2017년 5월 13일
Thanks a lot john, it works perfectly now

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by