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 件のコメント

Oliver Jaehrig
Oliver Jaehrig 約7時間 前
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.
Dimitri
Dimitri 約6時間 前
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.

サインインしてコメントする。

 採用された回答

Dimitri
Dimitri 約22時間 前

1 投票

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

製品

リリース

R2022a

質問済み:

2026 年 4 月 23 日 9:14

回答済み:

2026 年 4 月 24 日 8:32

Community Treasure Hunt

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

Start Hunting!

Translated by