Longest Common Subsequence
by David Cumin
26 Jun 2009
(Updated 27 Jul 2011)
Gives the longest common substring between two stings.
|
Watch this File
|
| File Information |
| Description |
%%%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) |
| MATLAB release |
MATLAB 7.3 (R2006b)
|
|
Tags for This File
|
| Everyone's Tags |
|
| Tags I've Applied |
|
| Add New Tags |
Please login to tag files.
|
| Updates |
| 28 Jun 2009 |
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! |
| 28 Jun 2009 |
Now will also work for integer inputs (not only strings). |
| 29 Jun 2009 |
Included support for 0 similarity |
| 27 Jul 2011 |
Changed the title to better represent the function. http://en.wikipedia.org/wiki/Longest_common_subsequence_problem |
|
Contact us at files@mathworks.com