フィルターのクリア

how can i find the numbers and their indices which are same

1 回表示 (過去 30 日間)
Farman Shah
Farman Shah 2018 年 12 月 10 日
コメント済み: Farman Shah 2018 年 12 月 10 日
this is my data
1 3 4 36
3 2 2 5
5 5 6 8
3 4 1 23
3 12 6 34
1 5 3 1
11 17 12 9
17 19 26 26
16 1 1 27
18 10 18 15
i want to return those indices and their numbers which are repeating. for example row one has no repeating value so skip it.row 2, row 3 ,row 6, row 8 row 9 and 10 has the repeating numbers. so i want to obtain these numbers and their indices.
thanks in advance

採用された回答

Stephen23
Stephen23 2018 年 12 月 10 日
編集済み: Stephen23 2018 年 12 月 10 日
M = [1,3,4,36;3,2,2,5;5,5,6,8;3,4,1,23;3,12,6,34;1,5,3,1;11,17,12,9;17,19,26,26;16,1,1,27;18,10,18,15];
for k = 1:size(M,1)
V = M(k,:);
[N,X] = histc(V,unique(V));
F = find(N>1);
Y = find(ismember(X,F)) % their column indices
Z = V(Y) % the repeated numbers
end
  6 件のコメント
Stephen23
Stephen23 2018 年 12 月 10 日
編集済み: Stephen23 2018 年 12 月 10 日
Sure, please ask.
Farman Shah
Farman Shah 2018 年 12 月 10 日
now my question is : If i get the cell value as {2,2,8,8} it means i have same number of votes for both classes. in this case i want to sum the posterior probabilty of both the classes (which i have calculated and saved) . For example the posterior probability of first element of the cell is 0.30 and the second is 0.45 (sum is equal to 0.75). now i check the posterior probabiltiy of second class i.e. class 8. for example i found that the posterior probabilty of class 8 fisrt element is 0.60 and the second is 0.30 (sum is equal to 0.90). as the posterior probability of 8,8 is greather then the 2,2 now i want {2,2,8,8} returns me only 8,8 . how to do this?
any help will be really appriciated
thanks
i posted this question also. if you like to reply me here .please
or kindly you reply on my next post

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

その他の回答 (1 件)

KSSV
KSSV 2018 年 12 月 10 日
Read about unique. Run unique for each row.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by