Comparing live scripts with names that do not end in .mlx

2 views (last 30 days)
I use MATLAB in a project that uses ClearCase for version control. While I know that full-blown ClearCase integration in MATLAB is a major project (but probably doable, since both have Java APIs for version control), I would already be a lot happier if I could compare and merge live scripts and Simulink models. I tried integrating mlDiff and mlMerge in ClearTeam Explorer, but stumbled over a naming convention used by ClearCase: Say the current version of a live script is <some path in CC view>\foo.mlx. When I ask ClearCase to compare this with the predecessor, it will extract the predecessor to <path to temp directory>\foo.mlx.compare.0 and then runs mlDiff on those two files. MATLAB compares them, but as binary files, as it does not recognize the predecessor version as a live script. Not very useful. The same thing happens to .slx or .mat files. Is there any way to force a comparison type for MATLAB files with strange names?

Answers (1)

Peter Miller
Peter Miller on 22 Jan 2024
Hi Philipp,
Starting in R2023b, the MATLAB Comparison Tool is more robust to invalid file names and extensions. If it is possible, upgrade to a more recent MATLAB release.
For releases prior to R2023b, before comparing files, users must ensure that the input files have correct extensions and valid names. For example, you can configure ClearCase to call a script that updates extensions before calling mlDiff/mlMerge.
I’ve attached an example script to get you started. You may need to update the path to mlDiff to make it work with the release you have installed.
Peter

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!