Call a Matlab function in Simulink for later code generation

Hello!
I need to use a MATLAB function in my Simulink project.
The problem is that this function needs to call other functions and load data from *.mat files (see image).
I also need to generate the code using Simulink Coder and Embedded Coder.
Which technique should I adopt from the answer below ?

2 个评论

What exact issue are you facing?
Calling a function should work, when the file is on the search path.
When loading a mat-file you could use:
coder.load
Thank you for further feedback.
Hello Olivier,
Finaly, it was the error that I've used a load() instead of coder.load() command for loading *.mat files. So now all works.

请先登录,再进行评论。

 采纳的回答

Finaly, it was the error that I've used a load() instead of coder.load() command for loading *.mat files. So now all works.

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

产品

版本

R2022a

提问:

2026-4-23,9:14

回答:

about 12 hours 前

Community Treasure Hunt

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

Start Hunting!

Translated by