Coordinate counting in MATLAB

Asked

Viewed 20 times

0

Hello. I have an 8x2 matrix:

M = [1 2; 5 8; 3 1; 6 6; 7 1; 1 2; 3 1; 7 1];

I would like to count how many times each line (x,y) repeats.

The result should be, for example, like this:

inserir a descrição da imagem aqui

Trying:

[i,j]=hist(M,unique(M)); out=[j' sum((i),2)]
  • What you’ve already done?

  • I tried this: [i,j]=hist(M,Unique(M)); out=[j' sum((i),2)]. But they are adding up each element and not the pair x,y.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.