I have a Simulink model whose goal is to automatically generate code.
My model uses S-functions (developed by the other side), which has hard-coded assumptions about the path. For example, several external data files are required, which are referred to in the S-function through a relative path, for example ..\Bin\data\datafile.bin . This forces you to set the current MATLAB working directory to a specific path before starting the model.
I can automatically check and set the correct path through the model callback functions. However, all the model callback functions are apparently related to the modeling process, and not to the assembly process. This means that I can run the model no matter which directory I enter, but when I try to create a model, it always fails if I do not manually go back to the correct directory in MATLAB.
Needless to say, this is pretty annoying. So I was wondering if there is something like a “preBuildFcn” callback fnuction, a function that runs before the start of the build process? Any other solution (not related to the modification of the S-function) is also very welcome.
source share