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

5 views (last 30 days)
Shayma Al Ali on 23 Nov 2021
Edited: the cyclist on 24 Nov 2021
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 CommentsShowHide 1 older comment
Shayma Al Ali on 24 Nov 2021
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 on 24 Nov 2021
Edited: the cyclist on 24 Nov 2021
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);