How to select a pixel on a figure and display linked data?

Starting from a matrix which contains only -1,0,+1 values, i compute distances between every positive point to 'tau' nearest negative ones. After i create an array of structures of this type:
mystruct(i).coord= [x y] % coordinates of positive point
mystruct(i).nearest= [x y] % where x and y are column vectors representing x and %y coordinates of 'tau' nearest points
mystruct(i).dist= d %d is a column vector with corresponding distance between i and one of tau nearest points.
Now, i want to display in a Figure the original matrix marking in different colors (ex red and blue)positive and negative points with the possibility of selecting one or more positives and showing marking with another color (ex green) the corresponding nearest neighbours. I guess i'll have to use a callback function associating it to ButtonDownFcn but i'm not so used to graphic function. Is there someone who can give me an help or just some links to better understand the procedure? Thanks in advance..

Respuestas (2)

Why can't you just use plot()?
plot(x1, y1, 'r+');
hold on;
plot(x2, y1, 'g+');

1 comentario

Responding to your "Answer" below... Can you upload a screenshot of your desired appearance so we can see what you'd like? Mock up something in Photoshop if you have to.

Iniciar sesión para comentar.

Giaime Origgi
Giaime Origgi el 24 de Abr. de 2013
Using only plot i can display all positives and negatives but i can't visualize every 'tau' negative neighbours linked to one positives..

1 comentario

Image Analyst
Image Analyst el 24 de Abr. de 2013
Editada: Image Analyst el 24 de Abr. de 2013
Is this an answer? I think it should have been a comment to me rather than an answer to your original question.

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 24 de Abr. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by