extract data based on certain range of other coloumn

조회 수: 2 (최근 30일)
TAPAS
TAPAS 2020년 4월 23일
댓글: Sulaymon Eshkabilov 2020년 4월 23일
I have attached an xlsx file which have four coloumns the first two coloumn are latitude and longitude .I want to extract data based on the condition 102.7<=long<=105.2 and 30.6<=lat<=32.2.

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 4월 23일
The answer is quite simple;
  1. Import data: D=xlsread('data.xlsx');
  2. Sort out the data w.r.t the conditions using logical indexing e.g.:
Lat = D(:,1);
Lon = D(:,2);
DN = D(:,3);
DE=D(:,4);
HD=D(:,5);
DD=D(:, 6);
Index =Lon>= 102.7 & Lon<=105.2 & Lat>=30.6 & Lat<=32.2;
DNnew=DN(Index);
DEnew = DE(Index);
etc.. etc.
  댓글 수: 3
TAPAS
TAPAS 2020년 4월 23일
Can I extract data bounded by an area like here inthis case if the lat long value of the four corner of the area is Corner 1:-lon=105.475 lat=32.549 Corner 2:-lon=102.987 lat=30.697 Corner 3:-lon=102.761 lat=30.919 Corner 4:-lon=105.249 lat=32.771 I want to extract data within the area which is bounded by these four corner. Can you do this?
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2020년 4월 23일
again use the indexing option around corner boundaries with <= and >=

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by