You can use the isequal
function to compare the two tables. If they have the same size and content, the function would return a logical 1. If you want to get the differences between the two tables, you can use the table
datatype and indexing.
Here's an example code snippet to get you started:
main.m501 chars15 lines
In this example, we create two tables t1
and t2
of the same size, but with different content. We use isequal
to check whether the two tables have the same content. Since they are different in this case, we find the differences in the col1
variable between the two tables using logical indexing and create a new table diffTable
with the differing rows and their values in each table.
gistlibby LogSnag