Code generation for "quadprog"
显示 更早的评论
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?
采纳的回答
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 个评论
Thank you
I am glad to be of help!
I want to ask why I upgrade matlab to 2020, but still report an error to show that this function cannot generate code?
Did you upgrade to release R2020a or release R2020b?
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.”
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.
Alan Weiss
MATLAB mathematical toolbox documentation
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 ?
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?
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.
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.
Dear li, has your hardware in the loop simulation with quadprog been implemented.
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Get Started with MATLAB Coder 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)


