Delete duplicate data rows from cell array
1 次查看(过去 30 天)
显示 更早的评论
Hello all,
I have 3D volumetric data assigned to specified objects.
My question is how can I delete duplicated data row? Data structure provided in attachment. Couldnt find smart solution.
Best regards
0 个评论
回答(1 个)
Jesus Sanchez
2020-2-16
A = [1 1 2 2 3 3 3];
[U, I] = unique(A, 'first');
x = 1:length(A);
x(I) = [];
Therefore in your code it sould be something like, supposing you are using the right column to detect duplicates, lets call it names
[~,I] = unique(names); % Detect unique cases of right colum and gives back their indexes
names(I) = []; % Deletes duplicates in names
volumetric_data(I) = []; % Deletes duplicates in left column.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!