GithubHelp home page GithubHelp logo

matlab-simulink-repo-template's Introduction

Template for a version controlled MATLAB-Simulink Repository

Simple basic template to clone and used for MATLAB-Simulink projects. Essentially provides

  • a .gitignore file,
  • m .gitattributes file for merging (binary) Simulink models
  • and some instructions to set up and use MATLAB Simulink for use with Git

Setup MATLAB once for use with Git

According to MATLAB's documentation:

  1. seup MATLAB (from MATLAB console)

    comparisons.ExternalSCMLink.setup()
  2. Add MATLAB diff to your .gitconfig. This can be done from within MATLAB with

    comparisons.ExternalSCMLink.setupGitConfig()
    

    Note for Windows users: In some cases MATLAB writes $PWD/ before the path in sections [mergetool "mlMerge"] and [difftool "mlDiff"]. This may fail using the git command line, as mlDiff writes the model versions to your Temp folder and then use the wrong path ($PWD/C:/Users/.../Temp/*.slx). Just delete the $PWD/ parts. Your .gitconfig sections should look like

    [mergetool "mlMerge"]
        cmd = \"C:/Program Files/MATLAB/R2020b/bin/win64/mlMerge.exe\" $BASE $LOCAL $REMOTE $MERGED
    
    [difftool "mlDiff"]
        cmd = \"C:/Program Files/MATLAB/R2020b/bin/win64/mlDiff.exe\" $LOCAL $REMOTE

    You need to replace your MATLAB path in the above example.

  3. The .gitattributes file of this directory automatically dispatches merges on Simulink models to MATLAB. I.e., models will be truly merged instead of only applying the newer version.

Use Git to show diffs on Simulink models

Again, following MATLAB's documentation: diff (from command line) with

git difftool -t mlDiff <revisonID1> <revisionID2> myModel.slx

# e.g. diff with previous version
git difftool -t mlDiff HEAD HEAD~1 myModel.slx

matlab-simulink-repo-template's People

Contributors

chhinze avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.