Unique function cell array conflict
Afficher commentaires plus anciens
Matlab is giving me a seemingly conflicting error message. It says that the 'rows' flag is ignored since NewParts is a cell array, however it says that it cannot perform the unique function since NewParts is not a cell array. whos says that NewParts is a cell array. Are there any ways to resolve this conflict?
>> Classification
Warning: 'rows' flag is ignored for cell arrays.
> In cell.unique at 31
In Classification at 103
??? Error using ==> cell.unique at 45
Input must be a cell array of strings.
Error in ==> Classification at 103
UNIQUE_NewParts = unique(NewParts,'rows');
whos
NewParts 2122x21 3330030 cell
Réponse acceptée
Plus de réponses (2)
Brian
le 28 Juin 2011
Jim Hokanson
le 1 Mai 2013
0 votes
I just stumbled upon this weird behavior recently. See: http://www.mathworks.com/matlabcentral/answers/74169-unique-rows-cell-array-ignored
In summary, a warning is thrown saying that unique will not work with the rows option, but then it proceeds perform unique on all elements anyways, at which point in time it fails due to type inconsistencies.
For others finding this answer, I've submitted a more general FEX submission a few years ago to address this problem: 25917: Unique Rows for a Cell Array
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!