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

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
Ivan van der Kroon 2011 年 6 月 7 日
insertfunction='cos(pi*x - beta1)'
>> symvar(insertfunction)
ans =
'beta1'
'x'

カテゴリ

ヘルプ センター および File 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