Borrar filtros
Borrar filtros

find simlar number in array

2 visualizaciones (últimos 30 días)
Mohammed
Mohammed el 9 de Nov. de 2012
if i have a big array (ex: 4x58) and there are some simalr numbers on it. i want to find how many each number on the array has been repeted. how can matlab help me on that? could you explain step by step please?
  1 comentario
Matt Kindig
Matt Kindig el 9 de Nov. de 2012
Editada: Matt Kindig el 9 de Nov. de 2012
Do you mean similar numbers (as in within a certain threshold apart) or identical numbers? If identical, you can use the hist() function.
doc hist

Iniciar sesión para comentar.

Respuestas (1)

Matt Fig
Matt Fig el 9 de Nov. de 2012
Editada: Matt Fig el 9 de Nov. de 2012
Similar or identical? Those are different! .5 is similar to .6, but not identical.
If you mean identical, you can count how many times each number occurs like this:
A = randi(30,5,5)
N = unique(A(:));
N(:,2) = histc(A(:),N)
  2 comentarios
Mohammed
Mohammed el 9 de Nov. de 2012
i mean identical sir.
can you tell me how can i use hist?
José-Luis
José-Luis el 9 de Nov. de 2012
The documentation is usually a good place to start.
doc histc

Iniciar sesión para comentar.

Categorías

Más información sobre Data Types en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by