Why am I getting an undefined function handle error when calling parfeval in MATLAB R2024b?

5 次查看(过去 30 天)

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
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 个)

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Perform Sensitivity Analysis 的更多信息

产品


版本

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by