Calling functions that have a variable name
Mostra commenti meno recenti
I have a set of functions that have the general naming scheme of: function%d_%d. They all have the same input and I want to call them within two loops (for example a loop for variable n and another for k, meaning calling for functionn_k). Is it possible to do so and how?
3 Commenti
Daniel Cohen
il 29 Ott 2023
Stephen23
il 29 Ott 2023
"...the generated functions are named (essentially as) functionn_k."
How exactly? Are you writing them as function files (Mfiles) or as variables in the workspace or something else?
Daniel Cohen
il 29 Ott 2023
Risposta accettata
Più risposte (1)
Catalytic
il 27 Ott 2023
Spostato: Image Analyst
il 28 Ott 2023
That sounds like a bad idea. You should probably make a single function where (n,k) are one of the arguments -
function oneFunction(n,k,other_arguments)
end
Categorie
Scopri di più su Loops and Conditional Statements 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!