- Check Fcn Compilation: Return input u + 1.
- Check Struct Load/Access. Load struct s at start of sim. Return s.a + u.
Troubleshooting an embedded MATLAB function in a compiled Simulink model
2 views (last 30 days)
Show older comments
Some background on my setup:
MATLAB version: 2010a (yes, I must be on this version because I am compiling for a 32-bit Linux target)
Simulink model with only an embedded MATLAB Function
The enbedded MATLAB function calls some other custom functions (all functions are on the MATLAB path)
The embedded MATLAB function also uses a parameter that is a structure. This structure is loaded into the base workspace.
Compilation uses a custom tlc file for the target and is done with rtwbuild.
Now this issue. I can run this model in Simulink and it works as expected. I then compile the model and that completes successfully. However, once I run the compiled model, I am not getting valid outputs from the embedded MATLAB function. Is there a good way to debug this in the compiled model? Are there some key things to check when using an embedded MATLAB function in a compiled model?
2 Comments
Peter O
on 25 Sep 2020
When and how is the structure loaded? Is the structure loaded as part of Simulink's OnRun or OnModelLoad (or whatever they're called) hooks? Is it done manually?
Can you verify the embedded fcn runs properly on the target with two simple MWEs?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!