Why am I getting an undefined function handle error when calling parfeval in MATLAB R2024b?
5 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2025-7-21
回答: MathWorks Support Team
2025-7-25
I am encountering a "MATLAB:UndefinedFunction" error with the message, "Undefined function handle" when running a MATLAB script in conjunction with a SimBiology program in MATLAB R2024b. The program performs a set of model fits to experimental data by submitting each model fit to a cluster using "parfeval". The cluster consists of the host computer (running a MATLAB SimBiology Model Analyzer interface and runs the program) and five additional compute nodes. This issue only occurs after the SimBiology program has been run at least once with the parallel pool generated by the cluster. How can I resolve this error?
采纳的回答
MathWorks Support Team
2025-7-21
To resolve this issue, ensure that all helper functions called within the code are separated into different .M files. Next, pass all these files to the workers by calling the "addAttachedFiles" method in the entry point MATLAB code.
For example:
p = parpool('YourCluster');
addAttachedFiles(p, ["function1.m", "function2.m", "function3.m", "function4.m", "function5.m", "function6.m", "function7.m"]);
0 个评论
更多回答(0 个)
社区
更多回答在 SimBiology Community
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Perform Sensitivity Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!