How to change values in a gridded matrix

2 ビュー (過去 30 日間)
Coastal_Eng
Coastal_Eng 2016 年 2 月 2 日
コメント済み: Coastal_Eng 2016 年 2 月 2 日
I am struggling to change the values of a DEM (Dig. Elev. Map.) for a specific area limited by a polygon.
I have the following data: The grid coordinates X Y and the data Z(grided with griddata) and a polygon coordinates x y where i want to change the Z inside that polygon. I want to add elevation over a loop (its a tidal cycle) only inside that polygon. Currently i was trying to separate the interpolation into two separated areas, so i would griddata the area inside the polygon and the area outside separately (using inpolygon).
But this solution is not very elegant and it is time consuming. Also the final result is messy.
Another option is to repeat the inpolygon and griddata for every loop step, but this will consume a huge amount of time.
I wonder if there is something out there that would allow me to select the area inside a polygon for a grided matrix.
Thank you very much Rod
  2 件のコメント
Walter Roberson
Walter Roberson 2016 年 2 月 2 日
Is the grid equi-spaced? If so then you could poly2mask and use the mask.
Coastal_Eng
Coastal_Eng 2016 年 2 月 2 日
Hey Walter,
Great advise. Just solved the problem. Thank you so much !
Cheers

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeElementary Polygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by