Is there a nice function that will remove duplicate entries in a cell array?
Some googling threw up the function ‘unique’, but it appears that only works if all the entries of the array are strings. Mine are 2×2 matrices.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve used a combination of CELLFUN, CELL2MAT and UNIQUE. The idea is to convert each matrix to a vector, convert those cell array to a matrix and apply unique, The result you can convert back to cell array with NUM2CELL.
Probably it can be done with less steps.
It’s important to remember that this code will work only if all the cell array elements have the same size.
You can check for this condition with