Using MATLAB comparison as an external diff tool

34 次查看(过去 30 天)
I am using Git and SourceTree for source control. How can I use MATLAB comparison tool as an external diff tool there? How should I change the .gitconfig or set the required command in SourceTree diff option?

回答(3 个)

Steven Lord
Steven Lord 2017-1-4
As of release R2016b you can use the instruction on this page in the documentation to configure an external source control tool to use the MATLAB Comparison Tool to diff and merge code.
  5 个评论
David Barry
David Barry 2018-9-18
@TS I am having the exact same problem as you but swapping to %LOCAL %REMOTE doesn't seem to solve it for me. I have attached a screenshot showing my config options from SourceTree. Can you please just confirm this is exactly what you entered to fix the issue?
Regards David
David Barry
David Barry 2018-9-18
In case anybody else is having this issue, the solution is to set the arguments to $LOCAL $PWD/$REMOTE

请先登录,再进行评论。


Jan
Jan 2017-1-4
You can call the built-in comparison tool, buit it is not documented and will be subject to changes. What is the desired output?
In Matlab R2016b:
file1 = which('plot.m')
file2 = which('diff.m')
html = comparisons_private('textdiff', file1, file2);
web(['text://', html])
Look into the source of comparisons_private.m to see more options.
You can find out these methods by starting the profiler and select the "Compare" menu in the editor. Afterwards profile report tells you, which functions are called. As far as I can see, this is not a reverse engineering of Matlab and therefore it is legal.

Rebecca Nakhoul
Rebecca Nakhoul 2020-5-12
To customize source control tools to use MATLAB for Diff and Merge, follow the steps described in the MATLAB documentation.
It covers source control tools such as SourceTree Git, Tortoise SVN and Perforce P4V.

类别

Help CenterFile Exchange 中查找有关 Source Control Integration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by