Longest Common Subsequence

版本 1.4.0.0 (1.7 KB) 作者: David Cumin
Gives the longest common substring between two stings.
3.0K 次下载
更新时间 2011/7/27

查看许可证

%%%INPUT
%%%X, Y - both are strings e.g. 'test' or 'stingtocompare'
%%%OUTPUT
%%%D is the substring over the length of the shortest string
%%%dist is the length of the substring
%%%aLongestString is a sting of length dist (only one of potentially many)

引用格式

David Cumin (2024). Longest Common Subsequence (https://www.mathworks.com/matlabcentral/fileexchange/24559-longest-common-subsequence), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2006b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Characters and Strings 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.4.0.0

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

1.3.0.0

Included support for 0 similarity

1.2.0.0

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

1.1.0.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!

1.0.0.0