Function vpa in matlab GUI

2 ビュー (過去 30 日間)
Olaniyi Olufunmilayo
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