Delete duplicate data rows from cell array

5 vues (au cours des 30 derniers jours)
K0tto
K0tto le 16 Fév 2020
Modifié(e) : K0tto le 28 Juin 2020
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

Réponses (1)

Jesus Sanchez
Jesus Sanchez le 16 Fév 2020
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.

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by