Simulink Project, internal files and source control

51 views (last 30 days)
I am trying to set up a Simulink Project from an existing set of files and models, in an existing git(lab) repository, for shared team development.
This existing content has already a well established structure. I am trying to add Simulink Project so that the team can utilize dependency analysis and Simulink diff/merge.
I understand how to set up the Simulink project initially, by adding paths and files, etc.
But the connection to souce control is not initially set up from Projects, because the existing files are already in source control.
I am now wondering
  • how to best configure the Simulink Project
  • which simulink project internal files I need to add to source control myself
I see the that the *.prj file is basically empty and that all the internal content is in the "resouces/project" folder.
There are a lot of files in that folder and I am wondering how those files will handle in source control, with collaborative development, and merging?
Are the internal files and their content fairly stable? Do they only change when files and folders are added/removed? Or every time I run a dependency analysis?
Are there a lot of merge challenges, as the project file and contents get loaded (and sometimes updated) by different users in their respective branches?

Answers (2)

Benjamin Thompson
Benjamin Thompson on 14 Feb 2022
I have used Simulink Projects with GIT for a while and had few problems with it. The files in the resources folder should only be added or removed as you add or remove files from the project. Making changes to files already in your Simulink Project should not affect what is in the resources folder. Make sure users are looking at the resources folder to do GIT add and commit at the same time they are adding and committing other files in the Project to GIT. The use case of a file move/rename can cause odd behavior because the next user pulling the changes may have their Simulink Project looking for the old file name or saying the new file name is missing from the repo. But it is easily recoverable, they can just manualy remove the old resource file and re-add the file under the new name to their project, and commit/push.
Simulink model and data dictionary diff/merge is a different thing, always handle this with care. These are not text files and the diff/merge tools can only do so much to help understand what was changed. If there is a conflict, my preference is to first understand what the last developer did to the file and then decide whether to manually merge my change into theirs, or to manually merge their change into mine.

Gavin Walker
Gavin Walker on 16 Feb 2022
Edited: Gavin Walker on 28 Jul 2022
Hello Kai,
Yes: all the project information is stored in XML files under the "resources" folder. There's a bit more info in the doc -- link at the end of this post -- but they store information about which files are in the project, any labels they have, if a file is a shortcut and so on. They are stored in a highly fragmented way, with many files, specifically to avoid merge issues when projects are used on large teams.
All of the files under "resources" need to be added to source control, otherwise the project will be broken/incomplete. Whilst there is a big initial commit, after that the contents of the resource folder should be very stable. They only change if you add or remove files from the project, change a label, etc.
Best wishes, Gavin


Find more on Project Management in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by