Delete duplicate data rows from cell array

5 ビュー (過去 30 日間)
K0tto
K0tto 2020 年 2 月 16 日
編集済み: K0tto 2020 年 6 月 28 日
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

回答 (1 件)

Jesus Sanchez
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.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by