Force C-code recompile in Simulink

2 次查看(过去 30 天)
Hi Guys,
I've been able to create a Simulink model, which utilizes some C++ code that I have created; code that will generate sine/cosine from input radians. Within the code, I have a #define which will vary how accurate the generated sine/cosine output is. Currently, if I run the model, it works as expected, if I then change the value of this #define, Simulink doesn't then re-compile the updated code. The only way that I have found which forces this re-compile, is if I go into the "Configuration parameters" and delete the include files within "Simulation Target\Header file", apply, and then run the model. Which will then result in the use of the new #define value.
Is there any setting, that I am missing, which will force a re-compile of the C-code when I run the model?
  1 个评论
Thomas
Thomas 2017-1-15
编辑:Thomas 2017-1-15
Have had a major play on this issue, and believe that I have found a way around this. I've created a function which will look within the working directory for a '.mexw64' file, and delete it (as this contains the compiled code). This as been configured such that it runs at initialisation of my model and voila, everytime that I change my C++ code and then run my model it retrieved the latest version! Note entirely sure if this is the correct way to fix this problem, but it appears to be working

请先登录,再进行评论。

采纳的回答

Thomas
Thomas 2017-1-15
After using the function that I've mentioned in my comment, I think that I have answered my problem.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by