Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diff between Simulink models .slx

I am using Git and I am using MATLAB/Simulink.

I know that there is some kind of integration in the new versions of MATLAB/Simulink with Git but I was wondering if there is an easy way to read a git diff between 2 Simulink models which are of the format .slx

This can be useful when, for example, you have a simulink model in which you have a so-called MATLAB Embedded Function and you want to understand what the differences are between the functions in different versions of your software.

It can be also useful to understand the blocks which were commented and all the differences between two different Simulink models (.slx).

like image 743
desmond13 Avatar asked Dec 05 '22 19:12

desmond13


1 Answers

I found a solution to my problem.

  1. If you are in your repository you MUST have a .git folder.
  2. Go to this folder and open the file config (create it if it is not available, but it should be there normally).
  3. Add the following code to the file:

    [diff "slx"]
    textconv = unzip -c -a
    
  4. Then you need to create or modify the file REPOSITORY/.gitattributes and add:

    *.slx diff=slx
    

In this way when you do a git diff on a Simulink model (.slx) you will have a quite readable result.

I hope it will help someone else.

like image 57
desmond13 Avatar answered Dec 30 '22 19:12

desmond13