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!