How can I prevent a new MATLAB session from being opened when using mlDiff from git-bash (git for Windows)?
이전 댓글 표시
Apologies if this question is really a "git-bash" question. The problem in short is: when I use mlDiff.exe in cmd.exe on Windows, existing MATLAB sessions are used to lauch the difference window, which I expect and desire. However if I run the same command in git-bash on Windows, it always opens a new MATLAB session, which is undesirable.
git-bash is from a regular git installation (https://gitforwindows.org/ or https://git-scm.com/downloads)
Detail:
I'm using MATLAB's mlDiff.exe on Windows 7 (located at C:/Program Files/MATLAB/R2019b/bin/win64/mlDiff.exe) to compare two .mlapp files (though the file extension is irrelevant to this problem, the same problem is true for .txt and .m files, etc), following the documentation here. When using the command "C:/Program Files/MATLAB/R2019b/bin/win64/mlDiff.exe" PATHTOA PATHTOB in a cmd.exe window, everything works as I'd expected: any open MATLAB session is "used" to open MATLAB's file diff window (which naturally is done very quickly), and if no MATLAB session is open, one is opened and then the diff window also opened. This is also true is git diff is set up to use the above command for .mlapp files, and no issue is present when git diff is executed in cmd.exe.
However if I instead use a git-bash shell to run this command, a new MATLAB session is always opened, which is slow, and made worse as git diff calls this command for each file I want to compare, so as many sessions are opened as files compared. I am using git-bash because it is easier to use for other git operations, the state of the git repo is easier to see at glance, various bash commands are available to me. It was included in the installation of Git (for Windows) and is detected and can be chosen as the default shell for GitHub Desktop (from: https://desktop.github.com/).
댓글 수: 4
Matthew Thomas
2020년 1월 22일
stozaki
2020년 1월 24일
I can't see the first command in your screenshot. Is the first command a "git diff" ?
Matthew Thomas
2020년 1월 24일
Gergely
2023년 7월 24일
@Matthew Thomas have you found a solution? I have the same issue.
답변 (2개)
Could you use "!" in the MATLAB command window?
for example
!git diff fileName
my result of example
>> !git diff lib.m
diff --git a/program/lib.m b/program/lib.m
index b97c00a..df3a439 100644
--- a/program/lib.m
+++ b/program/lib.m
@@ -1 +1,2 @@
-GGG
\ No newline at end of file
+GGG
+FFF
\ No newline at end of file
댓글 수: 2
Matthew Thomas
2020년 1월 24일
Markus Leuthold
2020년 6월 9일
I would also be interested in a proper solution of how to diff mat files. It would be nice to have a tool which allows to show equivalent mat files as identical (despite binary differences due to timestamps) and hence not as different files in git.
Ryan Dunk
2021년 11월 19일
0 개 추천
Enter: comparisons.ExternalSCMLink.setup()
카테고리
도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
