MATLAB: Referenced model dynamic path option

pathreferenced modelsimulink

Hi all,
I have a question about referenced models. I use them as components, repetitive function blocks. But I have a path issue. I also use svn and version my work.
For example I have model and referenced models in trunk.
  • …\trunk}model.slx
  • ..\trunk\referencedModel.slx.
Obviously model used referenced model with path ..\trunk\referencedModel.slx. My problem starts here, if I tag or move model.slx to an another folder, model keeps looking for the referenced model in the ..\trunk\referencedModel.slx (but the model.slx is located at for ex ..tags/v1.0/model.slx. How can I make this path dynamic, for example look into the same folder which model.slx locates. I am sure that there is a easy way which I don't know, otherwise how can big projects can be managed? 🙂
Thanks in advance.

Best Answer

  • OK, I found the solution. I update this topic in case anyone else has same problem/need.
    The solution is, the "matlab project" property, which I just learned from webinar Getting Started With Simulink. If one build a matlab project from a model, the project keeps all paths to all referenced models. If you move the project and models to an another folder, for example checkout to a different PC's desktop, all you have to do is to check dependencies of the model. If the model found any dependent files are missing (well, probably this will occur, since you checkout to an another folder), you just need to right click the missing models and select "Add External File". It automatically adds the file with its dynamic path $\project\etc...
    Thanks to the Getting Started with Simulink videos of Priyanka Gotika, MathWorks and Michael Carone, MathWorks.