Skip to content

Instantly share code, notes, and snippets.

@yesidays
Created January 15, 2012 04:34
Show Gist options
  • Save yesidays/1614334 to your computer and use it in GitHub Desktop.
Save yesidays/1614334 to your computer and use it in GitHub Desktop.
code.jobs - Distancia euclideana - Matlab
for j = 1:length(atributo)
fz = [atributo(j,1) atributo(j,2) atributo(j,3)];
for i=1:fi
% Formula
d(i,1) = sqrt(sum((fz-atributo(i,1:3)).^2));
% Almacenar Clase
d(i,2) = atributo(i,4);
end
%Organizar filas en orden ascendente
d = sortrows(d,1);
k = 140;
mayores = d(2:k,:);
%Obtener moda
[Moda frec] = mode(mayores(:,2));
status(j,5) = Moda;
status(j,6) = status(j,4) - status(j,5);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment