Calling functions that have a variable name
显示 更早的评论
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 个评论
Daniel Cohen
2023-10-29
Stephen23
2023-10-29
"...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
2023-10-29
采纳的回答
更多回答(1 个)
Catalytic
2023-10-27
移动:Image Analyst
2023-10-28
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
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!