How can I use quadprog in Simulink?
35 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I am using quadprog in a MatLab function in Simulink. When I run the simulation, I get the following error "Function 'quadprog' not supported for code generation". My purpose is running a simulation and interpreting the results, I don't want to generate any code from the model.
Any suggestions on how I can solve this issue?
Thanks in advance.
0 个评论
采纳的回答
Saleh Msaddi
2020-3-23
编辑:Saleh Msaddi
2020-3-23
4 个评论
Syed Ahmad Nadeem
2020-6-21
Thank you for the information Saleh. I tried using the code you mentioned above to work with the quadprog function in matlab embedded function. On using it I a receive another set of errors as:
'inner matrix dimensions must agree'
Simulink cannot determine sizes and/or types of the outputs for block 'linear_model_check/MPC controller' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
I tried exploring these errors further and it seems these generate from the command statement where I try to assign the outputs of 'quadprog' function to some variable name. If you could point in some direction, it would be really helpful. I am using Matllab 2018a, and trying to avoid the upgradation to 2020a.
更多回答(1 个)
Mary Fenelon
2020-4-21
Code generation support for quadprog was added in R2020a.
3 个评论
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?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multicore Processor Targets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!