Function vpa in matlab GUI

2 visualizaciones (últimos 30 días)
Olaniyi Olufunmilayo
Olaniyi Olufunmilayo el 13 de Mayo de 2017
Comentada: Olaniyi Olufunmilayo el 13 de Mayo de 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));

Respuesta aceptada

John D'Errico
John D'Errico el 13 de Mayo de 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.
  1 comentario
Olaniyi Olufunmilayo
Olaniyi Olufunmilayo el 13 de Mayo de 2017
Thanks a lot john, it works perfectly now

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by