フィルターのクリア

cleaning duplicate data unique matlab2013

1 回表示 (過去 30 日間)
catur suharinto
catur suharinto 2017 年 1 月 2 日
回答済み: Rik 2017 年 6 月 9 日
I have a matrix like the following. I tried to eliminate duplicate data on both sides with x1 as the primary key, wherein if x1 cleaned then x2 will be cleaned in the same position. using matlab 2013a I tried, but to no avail. is there any other way to eliminate the duplicate data. thank you
  2 件のコメント
Jan
Jan 2017 年 1 月 2 日
What does "x1 as the primary key" mean? Please explain "to no avail" with any detail.
catur suharinto
catur suharinto 2017 年 6 月 9 日
Dear Jan Simon Sorry for the unclear. I want to convert old matrix to new matrix.

サインインしてコメントする。

採用された回答

Rik
Rik 2017 年 6 月 9 日
I've seen a more efficient piece of code that can do this somewhere on this forum somewhere in past month or so, but I'm too lazy to look it up. So here is a solution that uses unique to find the indices and then uses a loop to fill y2.
x=[1 2 3 3 3 3 3 4 4 4 4 4 5 5];
y=[6 7 10 11 13 10 10 11 12 13 11 12 1 2];
x2=unique(x);
y2=zeros(size(x2));
for n=1:length(x2)
y2(n)=mean(y(x==x2(n)));
end

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by