How can I stop my Simulink model from generating slprj folder and .mex* files?

154 次查看(过去 30 天)
Hello,
Currently in part of my Simulink model I am using a Matlab fcn block to do some calculations. This block causes the model to create a .mexw32 file before running. How can I get the same functionality without the need of this extra file?
Also, many times when compiled the model a "slprj" folder will be created in the current directory. This folder does not appear to be necessary for the model to run. How can I stop this folder from being created?
According to the documentation found below, both of these items can be detrimental to a Simulink simulation. Because of that, I would like to know how I can stop generating them. http://www.mathworks.com/help/simulink/ug/work-with-derived-files-in-projects.html
Thank you.

回答(1 个)

Guy Rouleau
Guy Rouleau 2013-10-16
What the link below says about those files is "exclude them from source control". It does not say that they are detrimental in general.
The mainthing you need to keep in mind is that those files are not bad... not at all. In many cases, generating a mex-file speeds the simulation of your model.
The only disadvantage I can see of having an slprj folder created and a mex-file is that the update time of your model takes longer... this is trade off to make the simulation faster.
If this is very important for you to not generate mex-file and slprj folder (not for the reasons you mention), you can use the Interpreted MATLAB Function block of a MATLAB s-function instead... those do not generated code.
  3 个评论
Guy Rouleau
Guy Rouleau 2013-10-17
The slprj folder is used to generate the mex-file. One thing you can do is configure Simulink to put that code somewhere... look at the Simulink preferences
craq
craq 2014-1-30
I'd also like to avoid all those slprj folders cluttering up my working directories. The specific preference to look at is at the top level (Simulink Preferences). Under "File Generation Control", set "Simulation cache folder".
Note that if you want to do code generation, you have to change both this setting and the one underneath it (Code Generation Folder). Simulink doesn't seem to cope well with having one of these customised and one set to the default. (It seems to be otherwise arbitrary which folders you choose, as long as you don't happen to have one of them as your current working directory.)

请先登录,再进行评论。

类别

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