How to update main grid with a seperately created subgrid values

4 ビュー (過去 30 日間)
Mustafa Alper Cetintas
Mustafa Alper Cetintas 2021 年 8 月 10 日
コメント済み: darova 2021 年 8 月 12 日
Hello dear all,
Currently, having a difficulty to design an algorithm to update a grid's Z values with another subgrid values.
The main grid is 93x315 X,Y and Z(with NaN values). X,Y horizontal coordinates and Z is elevation.
Have another (xq,yq and zq) grid which is 24x24, I call it subgrid. This subgrid has X,Y values which cover smaller area inside of the main grid but Z values are different as it was interpolated. How can I substitute main grid's Z values with subgrid's interpolated Z values by finding correct location using their X and Y values.
As this issue exceeds my abilities, I would be appreciated for any suggestions, Thank you, Alper.

採用された回答

darova
darova 2021 年 8 月 11 日
Here is an example
ind1 = X < min(x(:)) & X < max(x(:)); % indices inbetween smallest and largest 'x'
ind2 = Y < min(y(:)) & Y < max(y(:)); % indices inbetween smallest and largest 'y'
ind = ind1 & ind2; % here is a region inside big matrix
The question: is the region will have size 24x24?
  2 件のコメント
Mustafa Alper Cetintas
Mustafa Alper Cetintas 2021 年 8 月 11 日
thank you a lot for your suggestion, really appreciated. I tried your script and I was able to find corresponding indexes in the main grid with this. the only thing remaining was assigning Z values at found indexes and I could somehow done that.
only made a change as below;
ind1 = X > min(x(:)) & X < max(x(:)); % indices inbetween smallest and largest 'x'
ind2 = Y > min(y(:)) & Y < max(y(:)); % indices inbetween smallest and largest 'y'
to answer your question, region size will change everytime but will stay inside of the main grid. and each time this one has been able to find indexes.
darova
darova 2021 年 8 月 12 日
happy to help

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by