フィルターのクリア

how to delete the duplicated rows (in a specific way)?

1 回表示 (過去 30 日間)
Amr Hashem
Amr Hashem 2015 年 5 月 16 日
編集済み: Andrei Bobrov 2015 年 5 月 16 日
i have this table (size:8*6 & cells):
and i want to delete duplicated rows with saving the 6th column in the original row.
i want the answer to be (table, size(5*8) , cell):
i have a larger data this is a sample, I hope that pictures clarify the problem.

採用された回答

Andrei Bobrov
Andrei Bobrov 2015 年 5 月 16 日
編集済み: Andrei Bobrov 2015 年 5 月 16 日
a = [text{:,1}];
m = numel(a);
[~,b1,c1] = unique(a,'first');
n = ones(m,1);
n(b1(2:end)) = 1-diff(b1);
i1 = accumarray([c1, cumsum(n)],(1:m)',[],[],m+1);
txt1 = [text(:,6);{''}];
out = [text(b1,1:5),tx1(i1)];

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by