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..

Antworten (2)

Image Analyst
Image Analyst am 24 Apr. 2013
Why can't you just use plot()?
plot(x1, y1, 'r+');
hold on;
plot(x2, y1, 'g+');

1 Kommentar

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.

Melden Sie sich an, um zu kommentieren.

Giaime Origgi
Giaime Origgi am 24 Apr. 2013

0 Stimmen

Using only plot i can display all positives and negatives but i can't visualize every 'tau' negative neighbours linked to one positives..

1 Kommentar

Image Analyst
Image Analyst am 24 Apr. 2013
Bearbeitet: Image Analyst am 24 Apr. 2013
Is this an answer? I think it should have been a comment to me rather than an answer to your original question.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Graphics Object Properties finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Apr. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by