how can I convert a string to an expression which "symvar" can search for identifiers?

1 次查看(过去 30 天)
how can I convert a string to an expression which "symvar" can search for identifiers?
I use this: symvar 'cos(pi*x - beta1)'
ans =
'beta1'
'x'
and it works, but when I use this:
insertfunction='cos(pi*x - beta1)'
symvar insertfunction
it doesn't have the same results. How can I make it?

采纳的回答

Paulo Silva
Paulo Silva 2011-6-7
insertfunction='cos(pi*x - beta1)'
symvar(insertfunction)

更多回答(1 个)

Ivan van der Kroon
insertfunction='cos(pi*x - beta1)'
>> symvar(insertfunction)
ans =
'beta1'
'x'

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by