Hi, I am trying to get code generation for "quadprog", I am getting error message "Function 'optimoptions' not supported for code generation". I am using MATLAB2018b. What might be the possible solutions?

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 11월 11일

3 개 추천

Code generation for optimoptions is only enabled in R2020b, and for quadprog(), it was enabled in R2020a. There is no way to get it in R2018b.

댓글 수: 13

KEERTHI CHACKO
KEERTHI CHACKO 2020년 11월 11일
Thank you
Ameer Hamza
Ameer Hamza 2020년 11월 11일
I am glad to be of help!
li gu
li gu 2021년 3월 8일
I want to ask why I upgrade matlab to 2020, but still report an error to show that this function cannot generate code?
Steven Lord
Steven Lord 2021년 3월 8일
Did you upgrade to release R2020a or release R2020b?
li gu
li gu 2021년 3월 8일
Upgrade 2020b, and I read the quadprog document. It's different from the previous version. It does have an extension function, which is to generate C code, but there are several restrictions. Then I modify the code one by one according to the conditions, basically meeting the requirements. I do hardware in the loop simulation, and need to compile to generate code. However, because this function compiles, it will still report an error. The error is as follows
The extrinsic function 'quadprog' is not available for standalone code generation. It must be eliminated for stand-alone code to be generated. It could not be eliminated because its outputs appear to influence the calling function. Fix this error by not using 'quadprog' or by ensuring that its outputs are unused.
Alan Weiss
Alan Weiss 2021년 3월 9일
Can you run the example Generate Code for quadprog? If not, then I suggest that you contact technical support. If so, then the fault is somewhere else in your code, because quadprog is supported.
According to the release notes, quadprog has been supported for code generation since R2020a.
Alan Weiss
MATLAB mathematical toolbox documentation
li gu
li gu 2021년 3월 10일
Later I ran this example and found the problem. Matlab did not find a supported compiler. Then I downloaded the MinGW-w64 C/C++ compiler. I ran this example successfully, but my hardware device supports VS software. , I downloaded VS2015 on my computer before, but why the VS compiler cannot be displayed when MATLAB runs the mex -setup command? I reinstalled VS2017 and MATLAB2020, but still can’t find the compiler. How can I solve this problem ?
li gu
li gu 2021년 3월 10일
Now matlab (2020b) has found a supported compiler (vs2017), but I still report an error in the process of compiling the model (The extrinsic function 'quadprog' is not available for standalone code generation). Previously, I used MinGW compiler to try to generate code for quadprog test cases, but the hardware in the loop simulation I did only supports vs compiler, so how can I solve this problem?
li gu
li gu 2021년 3월 10일
li gu
li gu 2021년 3월 10일
li gu
li gu 2021년 3월 10일
The above two figures are the established Simulink model and the self-defined AdaptiveMPC function in the model. There is a quadratic programming solving function quadprog in the function. The error is that this function cannot generate code.
li gu
li gu 2021년 3월 10일
Just now, it is OK to generate the test example of Quadlog function with vs2017 compiler. However, compiling my model will report the error that the Quadlog function cannot generate code.
GE YINBO
GE YINBO 2021년 9월 30일
Dear li, has your hardware in the loop simulation with quadprog been implemented.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with MATLAB Coder에 대해 자세히 알아보기

질문:

2020년 11월 11일

댓글:

2021년 9월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by