How do I use Git for version handling Simulink files?
36 ビュー (過去 30 日間)
古いコメントを表示
Hello What is the best way to version handle Simulink code using Git? I have looked at Simulink's .slx files and these seem to be binary files (as opposed to .m files that are simple text files). I am interested in being able to use Git to allow branching, merging branches and seeing the differences between two branches. Git can easily do this for text files but runs into problems with binary files. Is there a good way to handle this with Git? Best regards Nils
1 件のコメント
Bogdan Bodnarescu
2022 年 6 月 13 日
Hello,
I am trying to use also git for the version control of a model based software project where most of my code is generated from Simulink models, but I also have some manual code in between.
From what I can see, the merge feature for the Simulink is a total failure, merge works only when the merged branch is a child of the branch where I am merging, so basically a fast forward, but if there is even the smalles difference then the merge will do a total mess of merging the models, and it will basically compare apple with pears.
What I do actually is to revert all the merged Simulink models and then manually copy the differences, but as you can imagine this is a lot of manual work and it is very easy to lose some data.
Also I have another problem, and this is the C comments generated in the header files of the generated code from the Simulink models, because I can't find any way to configure git or a diff tool so that they will see only when a difference inside these comments exists and therefore to ignore these files and not to add them as modified files to a new commit.
採用された回答
Zack Peters
2016 年 10 月 19 日
Hi Nils,
The SLX file format can be considered a binary file and could be treated in GIT as any other binary file, i.e. it cannot be diff'd with a traditional text comparison tool.
As of R2016a release of MATLAB and onward there is a 3-way Diff/Merge tool supplied by the Simulink Report Generator Toolbox, which can be configured to work with your external source control tool .
HTH, ~Zack
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!