patch question? image processing

Hello,
using the patch code I'd created a map, anyone know how I can generate the patch without that line (between the island and the corner)..and how can I use the patch with nans data
https://www.dropbox.com/s/qyrkj9b1409197x/patch.jpg
Regards

 Accepted Answer

How are you creating the patch? Is it only one patch?
If you want the patches to be painted, you will need to create two patches: one for the island and one for the mainland.
Otherwise, you can create only one patch by introducing NaNs. For example:
V=[0,0;1,0;0,1;1,1;2,1;1,2;NaN,NaN];
patch('Vertices',V,'Faces',[1,2,3,1,7,4,5,6,4,7]);
That code creates two triangles without any connection between them.

5 Comments

Hello Hugo. It's only one patch, so, I have this two coastlines separated by NaNs (mainland and island), for example (It's not the real data):
-73.6261 -48.1174
-73.6266 -48.1172
-73.6270 -48.1170
-73.6277 -48.1169
-73.6283 -48.1168
-73.6288 -48.1166
-73.6294 -48.1165
-73.6300 -48.1163
-73.6300 -48.3800
NaN NaN
-73.4989 -48.1791
-73.4999 -48.1781
-73.5020 -48.1777
-73.5031 -48.1769
-73.5029 -48.1759
-73.5031 -48.1751
-73.5053 -48.1733
NaN NaN
so, I'm trying to do it, but nothing happens =(
Assume that
V=[-73.6261 -48.1174 -73.6266 -48.1172 -73.6270 -48.1170 -73.6277 -48.1169 -73.6283 -48.1168 -73.6288 -48.1166 -73.6294 -48.1165 -73.6300 -48.1163 -73.6300 -48.3800 NaN NaN -73.4989 -48.1791 -73.4999 -48.1781 -73.5020 -48.1777 -73.5031 -48.1769 -73.5029 -48.1759 -73.5031 -48.1751 -73.5053 -48.1733 NaN NaN];
Be sure that the matrix is m x 2. Then you can do: patch('Vertices',V,'Faces',1:18);
This plots two segments defined by the points you mentioned.Does this helps you?
Otherwise, try using two patches instead:
patch('Vertices',V,'Faces',1:9); hold on patch('Vertices',V,'Faces',11:17);
Please clarify - you accepted the answer so I think this question is done, right?
Yes Image Analyst. Accepting the answer means the question has been addressed to the satisfaction of the person asking the question. He seems to have a few extra questions that he hopes Hugo can assist him with.
yes Hugo, thanks.

Sign in to comment.

More Answers (0)

Asked:

on 6 Jul 2013

Community Treasure Hunt

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

Start Hunting!