How to get the indices from a matrix and apply it to vectors?

조회 수: 3 (최근 30일)
Shayma Al Ali
Shayma Al Ali 2021년 11월 23일
편집: the cyclist 2021년 11월 24일
I have a matrix of wind speeds that is 80 x 160. I also have vectors of latitudes (80x1) and longitudes (160x1). I want to be able to find high wind speeds in the matrix and then also use those indices to get the latitudes and longitudes. How could I go about this?
  댓글 수: 2
the cyclist
the cyclist 2021년 11월 24일
편집: the cyclist 2021년 11월 24일
Exactly what you want to do is not clear to me.
Suppose you had this smaller, 3x5 matrix instead (and associated lat/long):
rng default
lat = rand(3,1);
long = rand(5,1);
wind = rand(3,5)
wind = 3×5
0.9575 0.9706 0.8003 0.9157 0.6557 0.9649 0.9572 0.1419 0.7922 0.0357 0.1576 0.4854 0.4218 0.9595 0.8491
Which "high wind speeds" do you want?
Shayma Al Ali
Shayma Al Ali 2021년 11월 24일
So in my matrix, the wind speeds range from 2 to 20 m/s. I want to get the wind speeds that are greater than 15 m/s. I also want to get the lats and lons of those wind speeds that are greater than 15 m/s.

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

채택된 답변

the cyclist
the cyclist 2021년 11월 24일
편집: the cyclist 2021년 11월 24일
Here is how you can do that, using my small example:
rng default
HIGH_WIND = 0.96; % <------ CHANGE THIS TO 15
lat = rand(3,1);
long = rand(5,1);
wind = rand(3,5);
high_wind = wind(wind>0.96);
[high_wind_lat_idx, high_wind_long_idx] = find(wind>HIGH_WIND);
high_wind_lat = lat(high_wind_lat_idx);
high_wind_long = long(high_wind_long_idx);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Geodesy에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by