Finding the outline of part of a matrix

7 Ansichten (letzte 30 Tage)
Claire
Claire am 17 Apr. 2013
I have a 2D matrix of latitude and longitude coordinates that I have used to create a mask. The mask is comprised of NaNs and 1s, depending on if the grid box is included in my mask.
What I want to do is find the coordinates of the boundary of this mask, so that I can plot a line around the shape designated by the 1s.
For example:
NaN NaN NaN NaN NaN
NaN 1 1 NaN 1
NaN 1 1 1 1
NaN NaN NaN 1 NaN
How do I draw a line around the shape seen in the 1s, and save the coordinates of this line so that I can overlay it in other plots?
I've tried using contour, but it gives diagonal lines, where I only want horizontal or vertical lines.
I found this thread http://www.mathworks.com/matlabcentral/newsreader/view_thread/304168 but I wasn't able to follow the solution.
Any help would be greatly appreciated.
  1 Kommentar
the cyclist
the cyclist am 17 Apr. 2013
What, precisely, do you want the output to be, when the input is the matrix you gave us?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by