String to a mathematical expression

2 次查看(过去 30 天)
how can i convert a String to a mathematical expression , that i can use in a function's body ?

采纳的回答

Matt J
Matt J 2013-12-22
If you display the string at the command line, you can then copy/paste it into the function's body.
  2 个评论
Elia
Elia 2013-12-22
i want to get the string from an edit text feld in a gui . it will be a function's body that i want to plot it .
Matt J
Matt J 2013-12-22
编辑:Matt J 2013-12-22
If the string will always be a function of a known letter, e.g. 'x', you can do
theFunc = str2func(['@(x)' theString])

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by