# How to scale the data with matric of lon (1300 x 1300) and lat (1300 x 1300) ?

4 ビュー (過去 30 日間)
Long 2022 年 10 月 31 日

Dear all,
I'm analyzing the data related to atmosphere. My data have structure like
longitute (1300 x 1300): from 95.5132 - 131.7989 E
latitute (1300 x 1300): from 4.5498 - 31.8399 N
data (1300 x 1300): data information.
Now I want to cutting the region (data) into 118 - 124E, 20 - 28N.
First, I try to find the index of matrix with "find" command:
>> lon_region = find((geo.lon > 118) & (geo.lon < 124));
>> lat_region = find((geo.lon > 20) & (geo.lon < 28));
But the results outcome are lat_region with 487820x1 double and lon_region with 370264x1 double.
Based on this result, I cannot extract the data region from original one.
In my points of view, I struggles with the maxtric format of "lon" and "lat" that cause me confusion and don't know how to deal with it. I think it may be deal with "loop function" but I would take long time, so there is any ways to deal with ?

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

### 採用された回答

Simon Chan 2022 年 10 月 31 日
Use idexing as follows and please verify the variable names you are using.
lon_idx = (geo.lon > 118) & (geo.lon < 124); % Range for lon
lat_idx = (geo.lat > 20) & (geo.lat < 28); % Range for lat
valid_idx = lon_idx & lat_idx; % Range for lon & lat
lon_region = geo.lon(valid_idx); % Extract the lon_region
lat_region = geo.lat(valid_idx); % Extract the lat_region
data_region = geo.data(valid_idx); % Extract the data (NOT sure the variable name for yoru data)

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

### カテゴリ

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by