To drop the duplicate rows in a matrix or a table in Matlab, we can use the unique() function. The unique function can be used with the 'rows' option for matrices, and with 'stable' and 'rows' options for tables. The code snippets are provided below for matrices and tables.
Drop duplicate rows in a matrix:
main.m57 chars3 lines
Drop duplicate rows in a table:
main.m147 chars4 lines
In the above example for tables, 'stable' option is used to retain the order of the input rows, in the final output.
gistlibby LogSnag