How to get the indices from a matrix and apply it to vectors?
1 次查看(过去 30 天)
显示 更早的评论
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
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)
Which "high wind speeds" do you want?
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!