how can i find the numbers and their indices which are same
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Farman Shah
el 10 de Dic. de 2018
Comentada: Farman Shah
el 10 de Dic. de 2018
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
0 comentarios
Respuesta aceptada
Stephen23
el 10 de Dic. de 2018
Editada: Stephen23
el 10 de Dic. de 2018
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 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!