I have a 517x401 meteorological data matrix containing values between 0 to 1. The latitude and longitude vectors are 401x1 and 517x1 respectively.
I want to find data with values greater than 0.5, and the corresponding latitude and longitude values.
Using find() to do this yields an index vector that does not serve the purpose. What is an appropriate way to do this?
Thanks.

댓글 수: 3

DGM
DGM 2021년 3월 26일
How does the index vector not serve the purpose? If you want subscripts instead of linear indices, you can convert them using ind2sub().
Rik
Rik 2021년 3월 26일
What code are you using? For 2D data you don't even need ind2sub.
DGM
DGM 2021년 3월 26일
Rik is right. I forgot find() supports both syntaxes:
linearindices=find(X);
and
[rowsubs colsubs]=find(X);

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2021년 3월 26일

0 개 추천

[X,Y] = meshgrid(lon,lat);
idx = A>0.5 ; % A is your data
iwant = [X(idx) Y(idx) A(idx)] ;

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

질문:

SSM
2021년 3월 26일

댓글:

DGM
2021년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by