필터 지우기
필터 지우기

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

조회 수: 101 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2016년 3월 4일
댓글: Jan Kappen 2024년 7월 6일
I would like to use the live script files with source control, what is the workflow for that?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2024년 6월 6일
편집: MathWorks Support Team 2024년 6월 7일
How to source control your files within MATLAB:
Since R2014b, you can integrate MATLAB with the Git source control system through the Current Folder browser (see the workflow shown in this video ).
To avoid corruption when doing so, you must register your MATLAB and Simulink file extensions such as .mlx, .mat, .fig, .mlapp, .mdl, .slx, .mdlp, .slxp, .sldd, and .p as binary formats. See more details here:
https://www.mathworks.com/help/matlab/matlab_prog/set-up-git-source-control.html
How to diff/merge your files:
Support for comparing live code (.mlx) files has been shipping with MATLAB since R2018a. A two-way merge tool was also added in R2018b. External version control tools can be configured to use MATLAB Comparison tool using the setup instructions outlined here:
https://www.mathworks.com/help/matlab/matlab_prog/customize-external-source-control-to-use-matlab-for-comparison-and-merge.html
Future improvements:
We're committed to making the Live Editor features work more seamlessly with source control – and we're also committed to providing an enhanced experience with plain text MATLAB files. We're working hard on both of these fronts, so stay tuned for future updates!
  댓글 수: 5
Markus Leuthold
Markus Leuthold 2022년 1월 4일
  • you cannot see any diffs on github
  • you cannot git blame
  • you cannot make one commit per topic by staging single lines which belong to a certain topic
All of these are important aspects of git which I don't want to loose
Hamid Farshi
Hamid Farshi 2024년 7월 6일
Starting with MATLAB R2024b if you use the "new MATLAB Desktop", you have the option of saving your MLX to M based live script. You can also change your settings so that all of your new live scripts would be M based .

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Teemu Sillanpää
Teemu Sillanpää 2018년 3월 22일
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).

Markus Leuthold
Markus Leuthold 2019년 4월 1일
This is going into a completely wrong direction. Source code files must be text files. The toolchain does not only consist of Matlab, but many other such aus Github etc... which become unusable with these mlx files.
Unfortunately, there are already new features which are only available in the Live editor, but not in the classic editor or command window, such as tab completion via functionSignatures.json
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 4월 1일
I used to rail against web pages with images because "Source code files must be text files!", and you couldn't copy and paste the representation of images. I lost that fight, Tools evolved.
I also appear to have lost the fight against CSS...
Michael Abboud
Michael Abboud 2021년 6월 29일
Hi Markus, I'm a developer on the MATLAB Editor team and I'm glad to share that this Auto Completion functionality from the Live Editor is now available in plain text (.m) MATLAB files in the R2021b pre-release of the MATLAB Editor!
Many of the other coding tools from the Live Editor (Block selection, Refactoring, etc.) are also now available in plain text (.m) MATLAB files – along with a refreshed look and feel – starting with the R2021b pre-release which launched last week.
We think this is a big step forward, and we're excited for you to give it a try! If you're able to install a new version of MATLAB, I'd encourage you to try out the R2021b pre-release and send us feedback:

댓글을 달려면 로그인하십시오.


Richard Crozier
Richard Crozier 2018년 3월 21일
편집: Richard Crozier 2018년 3월 21일
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.

Jan Kappen
Jan Kappen 2021년 6월 22일
편집: Jan Kappen 2021년 6월 22일
Any updates on that? Workarounds? Plugins for Github or GitLab? Mathworks is effectively destroying any kind of collaboration, --automatic testing-- (wrong, see below) and code reviewing.
I'd stick to .m files if the editor wasn't that bad :(
Even juypter notebook files are in text format... The Notebook file format — nbformat 5.1 documentation
  댓글 수: 12
Hamid Farshi
Hamid Farshi 2024년 7월 6일
Starting with MATLAB R2024b if you use the "new MATLAB Desktop", you have the option of saving your MLX to M based live script. You can also change your settings so that all of your new live scripts would be M based .
Jan Kappen
Jan Kappen 2024년 7월 6일
Yep, already checked that out, it's nice!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Git in MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by