How to convert symfun into string in MATLAB

Viewed 148

I simply did this

enter image description here

This results in variables like this

enter image description here

I want to convert this ySol into a string something like this "C1*exp(t^2/2)"

As I am making a GUI application I want to display this solved equation value in a TextBox

I tried

num2str(ySol)
compose(ySol)
cprintf(ySol)
sprintf(ySol)
1 Answers

You can use:

char(ySol)   % to get the following char   array 'C1*exp(t^2/2)'
string(ySol) % to get the following string array "C1*exp(t^2/2)"

Noticed that this is an undocumented matlab feature, it could be removed at anytime.

Related