该帮助的版本不再更新,请参见https://www.jmp.com/support/help/zh-cn/15.2 获取最新的版本.


The Shortest Edit Script() function compares two strings, lines, or sequences and returns a list of changes or a matrix that describes the changes. You might use Shortest Edit Script() to identify differences between two columns, lists, or matrices. The function describes a (not the) shortest list of instructions to convert sequence A into sequence B. There might be more than one shortest script.
t1 = New Table( "t1",
New Column( "Column 1",
Format( "Best", 12 ),
Set Values( [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7] )
t2 = New Table( "t2",
New Column( "Column 1",
Format( "Best", 12 ),
Set Values( [2, 3, 4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 6] )
EditScript = Shortest Edit Script( // compares column 1 in each table
N Rows( t1 ),
N Rows( t2 ),
Function( {a, b}, // subscripts the columns
t1:column 1[a] == t2:column 1[b] // in data tables t1 and t2
aa = "this is$a test of@shortest$edit script lines$with several words";
bb = "this is a$test of$shortest$edit script lines with several@words";
Shortest Edit Script( lines( aa, bb, separators( "@$" ) ) );
See “Shortest Edit Script( A, B )” in the JSL Syntax Reference for more information.