Longest Common Subsequence

Gives the longest common substring between two stings.

Download
Download

You are now following this Submission

Cite As

David Cumin (2026). Longest Common Subsequence (https://www.mathworks.com/matlabcentral/fileexchange/24559-longest-common-subsequence), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.4.0

Changed the title to better represent the function. http://en.wikipedia.org/wiki/Longest_common_subsequence_problem

Download
1.3.0

Included support for 0 similarity

Download
1.2.0

Now will also work for integer inputs (not only strings).

Download
1.1.0

Sorry - a simple operator change fixed that. Should work now. The answer to your 'test' 'stingtocompare' is [0.5 2 'st'].
Thanks for pointing out the error!

Download
1.0.0

Download