To compare two tables in MATLAB we can use the isequal
function. This function returns a logical value that is true if the two input tables have exactly the same variable names and data, and false otherwise. If the tables are not equal, we can use the table
function to display the differences between them. Here is an example:
main.m555 chars15 lines
This code will output:
main.m364 chars8 lines
This output shows that the tables have the same variable names but different data. The left columns show the data from the first table (t1
) and the right columns show the data from the second table (t2
). The rows that are different are highlighted (in this case, row 2 and row 3), so we can quickly see what is different between the two tables.
gistlibby LogSnag