Occasionally when creating a SimFunction, SimBiology returns a failure to compile error, what causes this?

5 次查看(过去 30 天)
Sometimes when I try to create and compile a SimFunction, the following error happens:
Unable to create SimFunction:
--> Error reported from ODE Compilation:
Not enough input arguments.
Caused by:
Error using SimBiology.internal.compile
--> Error reported from ODE Compilation:
Not enough input arguments.
The code file will run in other versions of MATLAB (e.g. I just got this error in R2023a, but it runs fine on R2022b).

采纳的回答

Arthur Goldsipe
Arthur Goldsipe 2023-5-18
Hi Craig,
My guess is that this is some sort of bug. But it's hard to say definitively without reproduction steps. If you can consistently reproduce this, can you share the code? I'm assuming you don't want to share it publicly here on MATLAB Answers, so feel free to contact me directly. In general, I encourage folks to report anything that feels like a bug to Technical Support.
-Arthur
  2 个评论
Craig Thalhauser
Craig Thalhauser 2025-6-11
Hi Arthur--
I just installed R2025a and am getting this same error whenever I try to create a simfunction or verify a model. I created a simple 2-compartment PK model from the library, loaded it, and see this:
>> pkm = PKModelDesign;
pkc1 = addCompartment(pkm, 'Central', 'DosingType', 'Bolus', ...
'EliminationType', 'linear-clearance', ...
'HasResponseVariable', true);
pkc2 = addCompartment(pkm, 'Peripheral', 'HasResponseVariable', true);
[modelObj, PKModelMapObj] = pkm.construct
verify(modelObj)
modelObj =
SimBiology Model - Generated Model
Model Components:
Compartments: 2
Events: 0
Parameters: 11
Reactions: 4
Rules: 3
Species: 4
Observables: 0
PKModelMapObj =
PKModelMap with properties:
Dosed: {'Central.Drug_Central'}
DosingType: {'Bolus'}
Estimated: {4×1 cell}
Observed: {2×1 cell}
ZeroOrderDurationParameter: {0×1 cell}
LagParameter: {0×1 cell}
--> Error reported from ODE Compilation:
Not enough input arguments.
Arthur Goldsipe
Arthur Goldsipe 2025-6-11
I'm not able to reproduce this in my R2025a installation. My guess is that this indicates a problem with the installation. So the first idea I have is to try reinstalling to see if the problem reproduces. You could also run "restoredefaultpath" to make sure the MATLAB path hasn't been corrupted.
If the problem continues after a reinstall, then we can try to figure out exactly where/why the error occurs. My general approach to debugging errors is to run "dbstop if error; dbstop if caught;" and then rerunning repro steps. The debugger should then stop at the site of the error. You will likely stop in a P-coded file, so you won't be able to see full details of the code. But if you run "dbstack" you should still be able to see exactly what function and line of code is associated with the error. If you share that info with me, I can cross-reference that with the source. I also recommend saving the current workspace in a MAT file that you can share if needed.

请先登录,再进行评论。

更多回答(1 个)

Arthur Goldsipe
Arthur Goldsipe 2025-6-11
This error was caused by adding a custom folder to the MATLAB path. This folder contained a function that shadowed a MATLAB finction (strjoin), changing the behavior in an unexpected way. The issue was fixed by removing this folder from the path. Another option would be to add the folder to the END of the MATLAB path, to ensure that standard functions never get shadowed.

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Scan Parameter Ranges 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by