Code covered by the BSD License  

Highlights from
LCSSubStr-a function that return two string's largest common part

4.0

4.0 | 1 rating Rate this file 4 Downloads (last 30 days) File Size: 1.5 KB File ID: #27173

LCSSubStr-a function that return two string's largest common part

by Zhiping XU

 

05 Apr 2010

a function that return two string's largest common part

| Watch this File

File Information
Description

a function that return two string's largest common part

% Usage:
% [ret]=LCSubstr(s,t)
% s: input string 1
% t: input string 2
% ret: Largest Common String
% z: Largest Common String Length
% L : Compare matrix
% Example:
% >>a='This is very common string';
% >>b='string is very common';
% >>[ret]=LCSubstr(a,b)
% ret =
%
% very common

Acknowledgements
This submission has inspired the following:
String subsequence tools
MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
26 Apr 2010 Kevin J. Delaney

Just what I was looking for! Thanks! 好工作

06 Jun 2011 Rian Quinn

I believe the name of this function is miss-leading. The Longest Common Substring for the example given is "is very common". Also.... LCS I believe should return the string minus characters. For example, the LCS of [1, 2, 3, 4] and [1, 2, 2, 4] is [1, 2, 4]. This function only returns [1, 2].

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
string Zhiping XU 06 Apr 2010 10:22:29
strings in common Kevin J. Delaney 26 Apr 2010 15:47:12

Contact us at files@mathworks.com