Clear Filters
Clear Filters

Error at try to run simulink model for second time

2 views (last 30 days)
I am trying to run a loop with a simulink model in it. The first time it works fine but for the second time it always show this error : Could not open file C:\Users\~\AppData\Local\Temp\tpb8ede6ea_5590_4b49_86c5_5f94a36f1967rp948\w\slprj\slprj_sfprj\~\sfun\src\lib_Functions_sfun.mol. No such file or directory. for some reason it erases those temporary files after the first run and then expects them to be there for the second run. I already try to use clear all, in order to avoid any connection between the different runs but it always show the same error. The only solution I have found is to close and open Matlab again. That is not a real solution.

Answers (1)

Seth Hillery
Seth Hillery on 16 Jul 2018
Jorge,
I came across this same issue in one of my models. I am running Matlab R2017b in accelerator mode. It turned out that I had a set of generated code on my path that I didn't expect that contained the same model reference as the model I was trying to run. To describe my setup a little bit, maybe we have something in common that causes this error:
  • The problem model is contained in a model reference
  • The problem model has many library links to various different libraries
  • The problem model_sfun.mol is a linked library within my model reference and contains custom C code
So basically my model hierarchy was as such -- I was trying to run the 'Top Level' model:
Top level -> Library Link -> Model Reference -> Library Link -> C code call
^Code was previously generated at this level and was contained on my path
Deleting the code from this previous generation fixed my issue and allowed back-to-back runs. I have other model references that would have had the same issues but didn't complain though so I'm not sure exactly why this one reference didn't work.
Hopefully this helps
-Seth

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!