Why am I getting an undefined function handle error when calling parfeval in MATLAB R2024b?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 21 Jul. 2025
Beantwortet: MathWorks Support Team
am 25 Jul. 2025
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?
Akzeptierte Antwort
MathWorks Support Team
am 21 Jul. 2025
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 Kommentare
Weitere Antworten (0)
Communitys
Weitere Antworten in SimBiology Community
Siehe auch
Kategorien
Mehr zu Perform Sensitivity Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!