How to use a string to define a function handle?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Daiane Ferreira
le 1 Mai 2017
Réponse apportée : Steven Lord
le 1 Mai 2017
I have an anonymous function defined in a string. Although, I would like to use this string to define a function handle, so as the string contents is used to define a new variable. For example: I have A = '[x(1)^2+x(2)+x(3),-x(5)+x(3);0,x(1)^3]'; And I would like to have f = @(x) [x(1)^2+x(2)+x(3),-x(5)+x(3);0,x(1)^3]; In such a way that f([1 1 1 1 1]) = [3 0;0 1]; Do you know any function of matlab that I could use to convert this string in a way that the variable A can be used to define the function handle?
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur String Parsing dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!