Function vpa in matlab GUI
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Olaniyi Olufunmilayo
il 13 Mag 2017
Commentato: Olaniyi Olufunmilayo
il 13 Mag 2017
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));
0 Commenti
Risposta accettata
John D'Errico
il 13 Mag 2017
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.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!