Why function "care" doesn't work when used in function that is called from Simulink?

4 views (last 30 days)
Hello guys,
I am trying to solve an Algebraic Riccati Equation in Simulink. I have used a Matlab Function block in simulink in which I am trying to solve the ARE. But I get this error
"The function 'care' is not supported for standalone code generation. See the documentation for coder.extrinsic to learn how you can use this function in simulation." Does anyone know how to solve this problem?
Thanks in advance. Cheers,
Ethen

Answers (2)

Andrew Schenk
Andrew Schenk on 3 Mar 2015
Only a subset of MATLAB functions support C/C++ code generation. An alphabetical list of supported functions is located here: http://www.mathworks.com/help/coder/ug/functions-supported-for-code-generation--alphabetical-list.html
Notice that the function "care" is not present in this list.
You can still run MATLAB in "Normal" mode using the function "care", but if you attempt to use "Rapid Accelerator" mode or compile the Simulink model using the Simulink Coder you will encounter the error message you have given.

Rohollah Moghadam
Rohollah Moghadam on 9 Aug 2019
Edited: Rohollah Moghadam on 9 Aug 2019
Use the following code in your Matlab Function block in Simulink, before using 'care' function.
coder.extrinsic('care');
Note: The question is for long time ago. I hope this would be useful for who have same problems.

Categories

Find more on Matrix Computations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!