calling the function dynamically - is it possible using eval or evalin
Mostra commenti meno recenti
function data(k)
k = {sum,multiply,divide};
for l=1:numel(k)
[a,b,c] = data_sum(d,e)
end
end
The function data calls the another function called data_sum. Now i need to change the function name on every loop i.e data_multiply, data_divide. These functions also has the same number of input and output arguments as data_sum.
Is it possible to solve the above problem using eval, evalin or some other way ?
Thanks a lot
Risposta accettata
Più risposte (1)
Thorsten
il 31 Ago 2016
If you just have three functions, it's best to use
[a,b,c] = data_sum(d,e)
[a,b,c] = data_multiply(d,e)
[a,b,c] = data_divide(d,e)
1 Commento
Gopalakrishnan venkatesan
il 31 Ago 2016
Categorie
Scopri di più su Variables in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!