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

2 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

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

Più risposte (1)

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

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by