MATLAB Answers

Overlapping points

10 views (last 30 days)
Avni
Avni on 13 Jun 2012
Hello
I was wondering if there was a way to prevent points from overlapping. I have generated a [200 by 50] matrix and at a certain point the points will all match up. Is there a way to create a code in matlab that will prevent the points from overlapping when plotting. For instance at step one there is a point A at 23,4 and another point B is 23,5. At step two point A is still 23,4 and point B becomes 23,4 as well. Is there a way to say that at location 23,4, there is already a point and therefore point B should just stay at 23,5.
Thanks

Answers (1)

Rob Campbell
Rob Campbell on 13 Jun 2012
It's not very clear what you're plotting so it's a little hard to answer your question. Maybe some of the following help.
%New coordinates for B: newB=[23,4];
%Only alter this row and column in "myMatrix" if the value there is zero if myMatrix(newB(1),newB(2))==0 myMatrix(newB(1),newB(2))=1; end

Community Treasure Hunt

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

Start Hunting!