%% Edit Distance Between Two Strings
% Find the edit distance between the strings "Text analytics" and "Text analysis". The edit distance, by default, is the total number of grapheme insertions, deletions, and substitutions required to change one string to another.

str1 = "Text analytics";
str2 = "Text analysis";

% Find the edit distance.

d = editDistance(str1,str2)

% This means changing the first string to the second requires two edits. For example:
% Substitution – Substitute the character "t" to an "s": "Text analytics" to "Text analysics".
% Deletion – Delete the character "c": "Text analysics" to "Text analysis".
% Copyright 2018 The MathWorks, Inc.