s function builder source generation location

7 views (last 30 days)
I've been using the s function builder for a project and due to a modular design, I currently have 3 wtih plans to expand that as more complicated code is created. The problem is that each s function builder generates source files in the current working directory as stated in the docs here. Each S function builder is generating several files so it clutters up my main directory. I don't mind the mex files being in the main directory and it appears the generated source is not needed after mex files are generated as I can delete them and the simulation will still run without them as long as I don't make changes to the s function builder block.
I've attempted to tell Simulink to generate these files somewhere else using the cache folder and the code generation folder config as described by Simulink.fileGenControl but it seems to ignore those directories entirely. Is there a way to tell the s function builder to generate these files somewhere else? Or, tell it to clean the files up once its done with them? I realize re-generating these can be time consuming but that is worth having a manageable root folder.

Answers (2)

Krishna Zanwar
Krishna Zanwar on 22 Mar 2019
Hey Joshua,
You can cd to another directory and then use the s function builder so all the files are created there and then copy the files you want back to you main directory.

Joshua Hendrix
Joshua Hendrix on 24 Mar 2019
I attempted to do this and due to the paths to source being relative, it wont compile. The paths have to be relative since this gets passed around to other team members and the absolute path would be different for every person.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!