One way to compare two tables is to use the isequal
function. Here's an example:
main.m324 chars8 lines
This will print "The tables are equal: 0" because table1
and table2
have a different value in the Letters
column of the last row.
Note that isequal
can be used to compare tables with different variable names, as long as they contain the same data in the same order. However, if the tables have different variable types or sizes, isequal
will return false.
gistlibby LogSnag