MATLAB Answers


How do I use live script (*.mlx) files in source control?

I would like to use the live script files with source control, what is the workflow for that?

4 Answers

Answer by MathWorks Support Team on 23 Jun 2017
 Accepted Answer

It is possible to use source control with live scripts, the following points should be kept in mind:
  • Tell the source control system that files ending in .mlx are binary
  • Use the built in MATLAB file differencing tool to compare live scripts
  • Merging is currently limited to manual

  1 Comment

Do you have any instructions for configuring source control to use the MATLAB differencing tool? What is the correct command line?

Sign in to comment.

Answer by Teemu Sillanpää on 22 Mar 2018

So with the change from readable content (text) to binary, live scripts / to achieve .m files with documentation built in feature is totally useless in normal working environment (>1 user).


Sign in to comment.

Answer by Teemu Sillanpää on 10 Jan 2018

Has this "readable content being source controlled as binary" been fixed already?
The whole idea of readable code is the ability to commit/diff changes in readable form in source controlled environment. Now zipping the .XML to a .xml without the source control understanding the nature of the content is purely wrong approach. Live scripts can be written/converted also in .m but this is not intuitive process in the GUI environment - ending up having two source controlled files (risk of being unsync) between .m and .mlx. Third option would be that Mathworks provides GIT tools which understand the .mlx as readable content. Or the .mlx files being converted to ASCII (.m ish) before source controlled.
Any of these properties implemented yet in the R2017b or coming R2018a?


"Any of these properties implemented yet in the R2017b or coming R2018a?"
No. It is unlikely that the representation as a zip'd series of xml files will be changed any time soon.
As of release R2016b you can customize your source control system to use the diff and merge tools included in MATLAB for binary .mlx files. See this page in the documentation for instructions on how to configure your system.

Sign in to comment.

Answer by Richard Crozier on 21 Mar 2018
Edited by Richard Crozier on 21 Mar 2018

No you cannot use live scripts with any of the major version control systems such as svn, git or mercurial. They are a binary format and not compatible with these text difference based systems. Versioning the files will be possible in a very basic sense but none of the standard diffing and merging commands will work effectively, and none of the standard GUI tools for comparing versions will work as the files will simply appear as binary blobs.
You may be able to set up your source control system on one or two machines to work as specified in the Matlab docs, but no remote services such as Github or Bitbucket will support this.


Sign in to comment.