Application of casadi in rapid control prototype

The controller is coded in Simulink with "Matlab Function" module. When casadi toolbox is called using code 'import casadi.*' (like m.file), the compiler would go wrong with following information as :
"Import statements are currently unsupported. Function 'XXX' (#XXX.XXX.XXX), line XXX, column XXX: "import" Launch diagnostic report."
So how to call casadi in "Matlab Function" module correctly?

2 Comments

Hi! i'm having exactly the same issue! Could you please let me know if you find a way of making it work? (I'll for sure do the same if I manage to solve it).
Thanks for your time,
Daniel
Thank you for following this issue! Now I could run it in Simulation/Debug mode with "Matlab Function" block.
First, you need to write external function (like case.m file). Then, the external function needs to be declared before calling it with code "coder.extrinsic('case');" in "Matlab Function" block. In this way, it can work wel in these two modes.
However, the external declaration function can't build application which causes can't work in RCP platform.
If you have some advice, please leave a message!
Luka

Sign in to comment.

Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Products

Release

R2019b

Asked:

on 8 Mar 2023

Commented:

on 21 Mar 2023

Community Treasure Hunt

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

Start Hunting!