Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How do I convert sym to string in matlab? This is my code so far: syms x z = inp

ID: 3808814 • Letter: H

Question


How do I convert sym to string in matlab?
This is my code so far:

syms x
z = inputdlg(({'Function 1','Function 2','Function 3'}),'Calculus Program',[1 16; 1 32; 1 64])
    a1 = sym(z{1})
    b1 = sym(z{2})
    c1 = sym(z{3})
    a2 = diff(a,1)
    b2 = diff(b,2)
    c2 = int(c,x)


So the code is taking the derivative of z(1) and second derivative of z(2) then integrating with respect to x for z(3)
Now I get the answers but I want to convert them into string so I can use the pretty function on them and then send them to a GUI edit text box I will make in the future. Apparently sym2str used to be a command in matlab but no longer exists.

Explanation / Answer

You can use the char function in MATLAB to convert from symbol to string.

You can check MATLAB official documentation for that as well.

Also, if you want sym2str, it can be found here: https://in.mathworks.com/matlabcentral/fileexchange/19217-sym2str?focused=5110299&tab=function

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote