Count Relationships between two columns

I have this data (Click Here)
I'd like to count how many links a first column number is to a second column number, and so on. For example, how many times the number 1da first column has the number 1 in the second column?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 23 de Jun. de 2015
maxdata = max(max(Yourdata(:,1:2)));
counts = accumarray(YourData(:,1:2), 1, [maxdata, maxdata]);
Now counts(J,K) is the number of times the number J appeared in the first column with K in the second column of the same row.

Más respuestas (0)

Categorías

Más información sobre Dynamic System Models en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Jun. de 2015

Respondida:

el 23 de Jun. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by