Find the higher frequency for nearest value in column

Dear Colleagues, Could any body help me in the bellow code
x=[119.499;-0.192;-0.008;0.006;-0.398;-0.046;-0.028;0.104;-0.019;-0.003] In my matrix x, I want to retrieve the value which is higher in frequency with their nearest value. For instance, no value is duplicated, so the common value in my matrix to be closest with most of values

 Respuesta aceptada

Thorsten
Thorsten el 2 de Dic. de 2014
[X1 X2] = meshgrid(x, x');
D = sqrt((X1 - X2).^2);
x_closedtoall = X1(1, find(sum(D) == min(sum(D))))

Más respuestas (0)

Categorías

Más información sobre Mathematics en Centro de ayuda y File Exchange.

Preguntada:

el 2 de Dic. de 2014

Respondida:

el 2 de Dic. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by