Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Grouping data in close vicinity

Subject: Grouping data in close vicinity

From: SM

Date: 15 Dec, 2011 00:07:08

Message: 1 of 1

I need help with grouping the data.

firs I want to group the data in rows of the matrix where the number of the zeros between the data are less than TOL.
For instance assuming TOL=2 for the first row of the matrix it will be 2 group:

a(1,:)=[ 1 2 5 0 1 0 0 0 0 1 0 1]

then I want to group the created groups iin each row, with those of other rows if they are in close vicinity (TOL) , and put a rectangular around them while plotting, and each time if the cluster is updated, to remove the former cluster or fade it somehow.
a=[ 1 2 5 0 0 0 1 0 0 1 0 1;...
      7 2 0 0 0 0 1 0 4 1 0 1;...
      1 0 0 1 0 0 0 1 0 2 6 1]

the final out put will be following
out1=[1 2 5 0 ;...
          7 2 0 0;...
          1 0 0 1]

Out2=[1 0 0 1 0 1;...
           1 0 4 1 0 1;...
           0 1 0 2 6 1]

so, then the rectangular will be first around [1 2 5];
then when it iterates to the next row, it will be around [1 2 5; 7 2 0]
and at next step will be around Out1.

I guess I already grouped them in each row but I don't know how to combine them together, (however, I even doubt it whether I did it correctly)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us