首页 > 解决方案 > 如何在 MATLAB 中将 symfun 转换为字符串

问题描述

我只是这样做了

在此处输入图像描述

这导致像这样的变量

在此处输入图像描述

我想将此 ySol 转换为类似“C1*exp(t^2/2)”的字符串

当我正在制作一个 GUI 应用程序时,我想在 TextBox 中显示这个求解的方程值

我试过了

num2str(ySol)
compose(ySol)
cprintf(ySol)
sprintf(ySol)

标签: matlab

解决方案


您可以使用:

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)"

请注意,这是一个未记录的 matlab 功能,可以随时删除。


推荐阅读