What line ending does the MATLAB Editor use?

21 views (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 17 Jan 2019
When creating files, MATLAB uses the default line ending of the operating system it is being run on. On Windows, the default line ending is carriage return and line feed (CRLF). On Mac and Linux, the default line ending is just line feed (LF).
When editing files, MATLAB continues to use the same line endings regardless of the operating system. For example, if a user creates an M-file on Windows (using CRLF) and then edits the file in Linux (default LF), MATLAB will continue to use CRLF.
  1 Comment
Jan Kappen
Jan Kappen on 29 Jul 2020
Agreed...
It seems like Mathworks simply does not do much cross-platform development or interacts with GIT.
We're converting all our repos to utf-8 with LF right now to avoid huge conflicts in GIT. And we setup pre-commit hooks to ensure there are no CRLF left. And try to use proper .gitattributes...

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!