How to obtain and locate group of pixel value from .mat file

1 回表示 (過去 30 日間)
Karthik M
Karthik M 2021 年 10 月 1 日
コメント済み: Karthik M 2021 年 10 月 7 日
Hi Folks,
I have extracted chlorophyll from nc file attached
chlor_a max value 93.9236, chlor_a min value 0.0373
To identify and locate the number of pixels and its values which falls in particular grid
For example - I need to classify with pixel value interval with respective Lat [0 30] , Lon[30 100] (row and column) as shown and save in .csv/ .xls
range
0 - 2
2 - 4
4 - 6
6 - 8
8 - 10
10 - to the max
Thanks in advance
Kindly help
regards

採用された回答

KSSV
KSSV 2021 年 10 月 1 日
編集済み: KSSV 2021 年 10 月 1 日
Read about logical indexing. Let C be your data.
idx = C >= 0 & C < 2 ;
c02 = C(idx) ;
idx = C >= 2 & C < 4 ;
c24 = C(idx) ;
Also with the same indices you can get respective lon and lat.
  3 件のコメント
KSSV
KSSV 2021 年 10 月 1 日
You need not to use ind2sub. Straight away use maxind.
Karthik M
Karthik M 2021 年 10 月 7 日
Thanks in advance
I could get the indexed position of the rows and columns of max / index value data with the below code
maxval=max(data(:));
[xmax,ymax]=find(data==maxval);
[ii,jj]=find(data >= 0 & data < 2);
but I need only the exact x and y location coordinates
I have classify the the pixel range according to my requirement as below
idx = data >= 0 & data< 2 ;
pix1 = data(idx);
idx = data >= 2 & data < 4 ;
pix2 = data(idx) ;
idx = iwant >= 4 & iwant < 6 ;
pix3 = data(idx) ;
idx = data >= 6 & data < 8 ;
pix4 = data(idx) ;
idx = data >= 8 & data < 10;
pix5 = data(idx);
idx = data >= 10 & data < 15 ;
pix6 = data(idx) ;
idx = data >= 15 & data < 20 ;
pix7 = data(idx) ;
idx= data >= 20 & data < 95;
pix8 = data(idx);
Kindly help to get the exact x, y position of the group data

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by