To delete repeated rows from a matrix in MATLAB, you can use the unique
function.
For example, let's say you have a matrix A
:
main.m59 chars5 lines
To delete the repeated rows, you can call unique
on the matrix with the 'rows'
option:
main.m22 chars2 lines
This will return:
main.m62 chars6 lines
This will delete any rows that are exact duplicates of one another, leaving only one of each unique row remaining in the matrix.
gistlibby LogSnag